[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile
Daniel Hillier
report at bugs.python.org
Tue Oct 29 04:45:45 EDT 2019
Daniel Hillier <daniel.hillier at gmail.com> added the comment:
Good point. Thanks for the advice. I've updated it to use timeit. Does that give a better indication?
import zipfile
test_zip = "time_test.zip"
test_name = "test_name.txt"
# with zipfile.ZipFile(test_zip, "w") as zf:
# zf.writestr(test_name, "Hi there! " * 300)
def test():
with zipfile.ZipFile(test_zip) as zf:
for i in range(100000):
zf.read(test_name)
if __name__ == "__main__":
import timeit
print(timeit.repeat("test()", setup="from __main__ import test", number=1, repeat=10))
On my machine (running a usual workload) the best of 10 was:
master:
3.812s
check closed:
3.874s
But I think my machine had a quite a bit of variance between runs.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37523>
_______________________________________
More information about the Python-bugs-list
mailing list