[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-11-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.9 -Python 3.7, Python 3.8 ___ Python tracker __

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-11-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 8d62df60d8733d0fa9aee14ef746d0009a7a9726 by Serhiy Storchaka (Daniel Hillier) in branch 'master': bpo-37523: Raise ValueError for I/O operations on a closed zipfile.ZipExtFile. (GH-14658) https://github.com/python/cpython/commit/8d62df60d8733

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-29 Thread Daniel Hillier
Daniel Hillier 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!

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Daniel. But profiling is not good for benchmarking, it adds too much overhead. It can help to find narrow places, but for measuring effect of optimization you need to measure the raw time on non-debug build. Semantically your changes are correct.

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-28 Thread Daniel Hillier
Daniel Hillier added the comment: Here's the script I used for profiling and the results I observed with and without the closed check in read: 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 ther

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-10-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please test what performance effect it has on read()? -- nosy: +serhiy.storchaka ___ Python tracker ___ _

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-07-09 Thread Daniel Hillier
Change by Daniel Hillier : -- keywords: +patch pull_requests: +14465 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14658 ___ Python tracker ___ _

[issue37523] zipfile: Raise ValueError for i/o operations on closed zipfile.ZipExtFile

2019-07-09 Thread Daniel Hillier
New submission from Daniel Hillier : After closing a file object opened from a ZipFile, attempting i/o operations raises AttributeError because the underlying fd has been set to None. We should be raising ValueErrors consistent with io.FileIO behaviour. Similar inconsistencies exist for the f