[issue41350] Use of zipfile.Path causes attempt to write after ZipFile is closed

Jason R. Coombs report at bugs.python.org
Fri Jul 24 12:30:21 EDT 2020


Jason R. Coombs <jaraco at jaraco.com> added the comment:

This routine will repro the issue without relying on garbage collection to trigger the error:

```
import io
import zipfile
buf = io.BytesIO()
zf = zipfile.ZipFile(buf, mode='w')
zp = zipfile.Path(zf)
with zp.joinpath('zile-a').open('w') as fp:
    fp.write('contents of file-a')
zf.close()
buf.close()
zp.root.close()
```

----------

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


More information about the Python-bugs-list mailing list