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

2021-04-24 Thread Jason R. Coombs
Jason R. Coombs added the comment: Thanks Andrei -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2021-04-24 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> Using zipfile.Path with several files prematurely closes zip ___ Python tracker

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

2021-04-24 Thread Andrei Kulakov
Andrei Kulakov added the comment: Looks like a duplicate of https://bugs.python.org/issue40564 , which was fixed and closed so this can also be closed. -- nosy: +andrei.avk ___ Python tracker

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

2020-07-24 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Not sure if it's related to this issue there is an existing issue with ZipFile.__del__ : issue37773 -- nosy: +xtreak ___ Python tracker

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

2020-07-24 Thread Angel Siblani
Change by Angel Siblani : -- components: +Demos and Tools, XML, email -Library (Lib) nosy: +angelsb, barry, r.david.murray type: behavior -> resource usage versions: -Python 3.8, Python 3.9 ___ Python tracker

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

2020-07-24 Thread Jason R. Coombs
Jason R. Coombs 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:

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

2020-07-24 Thread Jason R. Coombs
Jason R. Coombs added the comment: I'm a little surprised from Nick's original post that the behavior is triggered. After all, the code [already has a protection for a previously-closed

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

2020-07-24 Thread Jeffrey Kintscher
Change by Jeffrey Kintscher : -- keywords: +patch pull_requests: +20745 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21604 ___ Python tracker

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

2020-07-24 Thread Rajarishi Devarajan
Rajarishi Devarajan added the comment: Hi all, I have a working patch for this. Could I submit it for review ? -- nosy: +rishi93 ___ Python tracker ___

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

2020-07-24 Thread Jeffrey Kintscher
Change by Jeffrey Kintscher : -- versions: +Python 3.10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-07-24 Thread Jeffrey Kintscher
Jeffrey Kintscher added the comment: I created a simpler test case that exercises the buggy code. The problem can be reproduced by passing ZipFile.__init__() a file-like object with the write flag (mode "w") and then closing the file-like object before calling ZipFile.close(). The

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

2020-07-23 Thread Jeffrey Kintscher
Jeffrey Kintscher added the comment: It looks like a copy of the zip_file object is getting created, probably by the Path constructor: zip_path = Path(zip_file, "file-a") When return is invoked, the copy still has a reference to the now closed bytes_io object which causes the

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

2020-07-23 Thread Jeffrey Kintscher
Change by Jeffrey Kintscher : -- nosy: +Jeffrey.Kintscher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-07-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +jaraco ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-07-20 Thread Nick Henderson
New submission from Nick Henderson : In both Python 3.8.3 and 3.9.0b3, using zipfile.Path to write a file in a context manager results in an attempt to write to the zip file after it is closed. In Python 3.9.0b3: import io from zipfile import ZipFile, Path def make_zip(): """Make zip