Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
danny0838 wants to merge9 commits intopython:main
base:main
Choose a base branch
Loading
fromdanny0838:gh-51067

Conversation

danny0838
Copy link

@danny0838danny0838 commentedMar 25, 2023
edited
Loading

This is a revision of#19358 (for issue#51067) as the original author seems not keeping working.

Notable changes:


pmdevita, barneygale, arhadthedev, pwuertz, titusz, and ajslater reacted with heart emoji
@ghost
Copy link

ghost commentedMar 25, 2023
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@bedevere-bot
Copy link

Most changes to Pythonrequire a NEWS entry.

Please add it using theblurb_it web app or theblurb command-line tool.

@danny0838danny0838force-pushed thegh-51067 branch 3 times, most recently from76722fa tof3450f1CompareMarch 26, 2023 12:37
@barneygale
Copy link
Contributor

Automatically compacting the.zip file seems like overkill. Suggestion: split this into two methods:

  • ZipInfo.remove() removes the record for the file, and by default zeroes out its data.
  • ZipFile.repack() reclaims free space.

The latter method is dangerous for self-extracting.zip files, which have an executable header before the the zip data begins. That header would be stripped out, I think.

@barneygale
Copy link
Contributor

barneygale commentedMar 30, 2023
edited
Loading

Also, please don't force-push to an open PR. It makes it harder for reviewers to follow changes! Thanks

@arhadthedevarhadthedev added the stdlibPython modules in the Lib dir labelMar 30, 2023
bpepple added a commit to Metron-Project/darkseid that referenced this pull requestAug 31, 2024
bpepple added a commit to Metron-Project/darkseid that referenced this pull requestAug 31, 2024
* Add remove method to ZipFileRefer to:python/cpython#103033* Make use of `ZipFileWithRemove`
@merwokmerwok added the type-featureA feature request or enhancement labelApr 24, 2025
@python-cla-bot
Copy link

python-cla-botbot commentedMay 22, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

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 theskip news label instead.

danny0838 added a commit to danny0838/cpython that referenced this pull requestMay 22, 2025
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))
@bedevere-app
Copy link

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 theskip news label instead.

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`.
@bedevere-app
Copy link

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 theskip news label instead.

@danny0838danny0838 changed the titlegh-51067: add ZipInfo.remove()gh-51067: addZipFile.remove()May 22, 2025
@danny0838
Copy link
Author

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.

pmdevita reacted with hooray emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@merwokmerwokmerwok left review comments

Assignees
No one assigned
Labels
awaiting reviewstdlibPython modules in the Lib dirtype-featureA feature request or enhancement
Projects
Status: No status
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@danny0838@bedevere-bot@barneygale@merwok@arhadthedev

[8]ページ先頭

©2009-2025 Movatter.jp