New GitHub issue #108526 from igorechek06:<br>
<hr>
<pre>
# Bug report
### Checklist
- [X] I am confident this is a bug in CPython, not a bug in a third-party project
- [X] I have searched the [CPython issue tracker](https://github.com/python/cpython/issues?q=is%3Aissue+sort%3Acreated-desc),
and am confident this bug has not been reported before
### CPython versions tested on:
3.8, 3.9, 3.11
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
_No response_
### A clear and concise description of the bug:
This simple example fully describe this bug
```python
from zipfile import ZipFile
with ZipFile("archive.zip", "w") as archive:
archive.comment = b"PK\005\006" + b"\000" * 18 # Archive has a comment
with archive.open("file1", "w") as file: # -\
file.write(b"content") # |
# |
with archive.open("file2", "w") as file: # |
file.write(b"content") # |- 3 files
# |
with archive.open("file3", "w") as file: # |
file.write(b"content") # -/
with ZipFile("archive.zip") as archive:
assert archive.comment == b"PK\005\006" + b"\000" * 18 # Error - archie has no comment
assert len(archive.filelist) == 3 # Error - archive has no files
```
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/108526">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>