Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-51067: addZipFile.remove()
#103033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
ghost commentedMar 25, 2023 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedMar 25, 2023
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
bedevere-bot commentedMar 25, 2023
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
76722fa
tof3450f1
CompareAutomatically compacting the
The latter method is dangerous for self-extracting |
barneygale commentedMar 30, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Also, please don't force-push to an open PR. It makes it harder for reviewers to follow changes! Thanks |
* Add remove method to ZipFileRefer to:python/cpython#103033* Make use of `ZipFileWithRemove`
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
python-cla-botbot commentedMay 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
This is a revision of commit659eb04 (PRpython#19358), notably with following changes:- Add documentation and tests.- Raise `ValueError` for a bad mode, as in other methods.- Support multi-member removal in `_remove_members()`.- Support non-physical removal in `_remove_members()`.- Move physical file data in chunks to prevent excessive memory usage on large files.- Fix missing entry in `self.NameToInfo` when removing a duplicated archive name.- Also update `ZipInfo._end_offset` for physically moved files.Co-authored-by: Éric <merwok@netwok.org>(cherry picked from commite6bc82a (PRpython#103033))
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
This is a revision of commit659eb04 (PRpython#19358), notably with following changes:- Add documentation and tests.- Raise `ValueError` for a bad mode, as in other methods.- Support multi-member removal in `_remove_members()`.- Support non-physical removal in `_remove_members()`.- Move physical file data in chunks to prevent excessive memory usage on large files.- Fix missing entry in `self.NameToInfo` when removing a duplicated archive name.- Also update `ZipInfo._end_offset` for physically moved files.Co-authored-by: Éric <merwok@netwok.org>(cherry picked from commite6bc82a (PRpython#103033))
- File is not truncated in mode 'w'/'x', which results non-shrinked file.- This cannot be simply resolved by adding truncation for mode 'w'/'x', which may be used on an unseekable file buffer and truncation is not allowed.
- The seek will be automatically called in `ZipFile.close`.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
The PR is being old and the base python executable can be hardly compiled. Rebased onto the latest Python and make sure it builds, with few trivial commits squashed together. |
Uh oh!
There was an error while loading.Please reload this page.
This is a revision of#19358 (for issue#51067) as the original author seems not keeping working.
Notable changes:
Added docs and tests.
Support mode 'w' and 'x', as noted byremove/delete method for zipfile/tarfile objects #51067 (comment)
Support removing multiple members and removing non-physically with the internal
_remove_members
method, as they may be used by some interested people, as noted byremove/delete method for zipfile/tarfile objects #51067 (comment) andremove/delete method for zipfile/tarfile objects #51067 (comment).They are not currently introduced in the public
remove
API, as it would involve more complicated changes to the public APIs (e.g. introducing error handling for multiple members, and a extra method that purges stale data by non-physical removing) and other ZipFile related APIs do not support similar operations.Move physical data in chunks, to prevent a memory issue for large files.
Fixed a flaw of the previous implementation that
self.NameToInfo
gets a missing key when removing one of duplicated arcnames.