[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2022-01-23 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.11 -Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-06-28 Thread Andrei Kulakov
Andrei Kulakov added the comment: I forgot to add, to fix the tests I also had to add `closed=False` attr to test_zipfile.Tellable. -- ___ Python tracker ___

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-06-28 Thread Andrei Kulakov
Andrei Kulakov added the comment: In my testing on 3.9.1 and the current `main` branch, I found: - I can reproduce this issue if a function or a lambda or class with a method are defined. - There is no error if a class is defined with no methods. (I'm not sure why). The test code runs withou

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-29 Thread STINNER Victor
STINNER Victor added the comment: FYI TextIOWrapper has a similar issue: bpo-17852. There was an attempt to fix the issue in 2017, but it had to be reverted. -- ___ Python tracker __

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-29 Thread STINNER Victor
STINNER Victor added the comment: IMO ZipFile destructor should emit a ResourceWarning if it's not closed explicitly. Nothing in the Python specification gives you any warranty that destructors will be ever called... Depending on the Python implementation and depending on many things, you n

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-29 Thread STINNER Victor
STINNER Victor added the comment: > Victor, were there any changes in the garbage collector or interpreter > shutdown code in 3.8? I took some notes there: https://pythondev.readthedocs.io/finalization.html I proposed bpo-42671 "Make the Python finalization more deterministic" but it will b

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-27 Thread Jörn Heissler
Jörn Heissler added the comment: Thanks Serhiy for the explanation, it's making sense now. Guess whatever I did back then (no idea what I was working on) was basically a mistake; I should have closed my ZipFile properly, e.g. by using context managers. So maybe it's not really a cpython bug.

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: That's what happened. Function foo creates a reference loop. It has reference to the module dict, and the dict has reference to the function. The dict has also references to BytesIO and ZipFile objects. At shutdown stage the garbage collector is called. It

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2021-03-27 Thread Jörn Heissler
Jörn Heissler added the comment: Still reproducible in cpython 3.10.0a3 (debian unstable) and 3.10.0a6 (pyenv). -- versions: +Python 3.10 ___ Python tracker ___ ___

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2019-08-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2019-08-06 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This looks like a regression in 3.8 so I have added 3.8 regression tag. -- keywords: +3.8regression nosy: +xtreak ___ Python tracker __

[issue37773] ValueError: I/O operation on closed file. in ZipFile destructor

2019-08-06 Thread Jörn Heissler
New submission from Jörn Heissler : When running this code: from zipfile import ZipFile import io def foo(): pass data = io.BytesIO() zf = ZipFile(data, "w") I get this message: Exception ignored in: Traceback (most recent call last): File "/home/user/git/oss/cpython/Lib/zipfile.py",