[issue40564] Using zipfile.Path with several files prematurely closes zip
Jason R. Coombs
report at bugs.python.org
Wed Aug 26 17:22:55 EDT 2020
Jason R. Coombs <jaraco at jaraco.com> added the comment:
I've attempted to replicate the issue in the [zipp](https://github.com/jaraco/zipp) test suite with this test:
```diff
diff --git a/test_zipp.py b/test_zipp.py
index a6fbf39..dc7c8aa 100644
--- a/test_zipp.py
+++ b/test_zipp.py
@@ -259,3 +259,10 @@ class TestPath(unittest.TestCase):
def test_implied_dirs_performance(self):
data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
zipp.CompleteDirs._implied_dirs(data)
+
+ def test_read_does_not_close(self):
+ for alpharep in self.zipfile_alpharep():
+ for rep in range(2):
+ p_ = zipp.Path(alpharep, 'a.txt')
+ with p_.open() as inner:
+ print(list(inner))
```
But the test passes.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40564>
_______________________________________
More information about the Python-bugs-list
mailing list