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

Jörn Heissler report at bugs.python.org
Tue Aug 6 05:35:50 EDT 2019


New submission from Jörn Heissler <launchpad2019 at tutnicht.de>:

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: <function ZipFile.__del__ at 0x7f9005caa160>
Traceback (most recent call last):
  File "/home/user/git/oss/cpython/Lib/zipfile.py", line 1800, in __del__
  File "/home/user/git/oss/cpython/Lib/zipfile.py", line 1817, in close
ValueError: I/O operation on closed file.

Comment out def foo: pass, and there is no error.

It looks like the bug was introduced with commit ada319bb6d0ebcc68d3e0ef2b4279ea061877ac8 (bpo-32388).

----------
messages: 349104
nosy: joernheissler, pitrou
priority: normal
severity: normal
status: open
title: ValueError: I/O operation on closed file. in ZipFile destructor
type: crash
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37773>
_______________________________________


More information about the New-bugs-announce mailing list