summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-02-19 00:17:03 -0800
committerGitHub <noreply@github.com>2018-02-19 00:17:03 -0800
commit71555c48be7f07833bd540dacb50deb8069b551f (patch)
tree62b83ac79df5fb1cbfdc6ac4b25e233c1fb980f8 /numpy/lib/npyio.py
parentbd7919ad34bf8fe94a239c4c76873db7fdc656db (diff)
parent50fde71f1ac0528f40ee216136b33fde41205ef2 (diff)
downloadnumpy-71555c48be7f07833bd540dacb50deb8069b551f.tar.gz
Merge pull request #10621 from ahaldane/fix_arrayprint_recursive_closure
BUG: deallocate recursive closure in arrayprint.py
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 096f1a3a4..73613d2a4 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1109,6 +1109,11 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None,
finally:
if fown:
fh.close()
+ # recursive closures have a cyclic reference to themselves, which
+ # requires gc to collect (gh-10620). To avoid this problem, for
+ # performance and PyPy friendliness, we break the cycle:
+ flatten_dtype_internal = None
+ pack_items = None
if X is None:
X = np.array([], dtype)