diff options
author | Allan Haldane <allan.haldane@gmail.com> | 2018-02-17 14:36:49 -0500 |
---|---|---|
committer | Allan Haldane <allan.haldane@gmail.com> | 2018-02-18 23:22:01 -0500 |
commit | 50fde71f1ac0528f40ee216136b33fde41205ef2 (patch) | |
tree | 8027f9c741d643efa82fcd3963dfdc90e14a9428 /numpy/lib/npyio.py | |
parent | 4105af42c38539e8bf854c49134fe221d86ec79d (diff) | |
download | numpy-50fde71f1ac0528f40ee216136b33fde41205ef2.tar.gz |
BUG: break cyclic refs in recursive closures
Fixes #10620
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 5 |
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) |