Support copy.replace() for zipfile.ZipInfo
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
There is no easy way to get a copy of a zipfile.ZipInfo object with some attributes changed, for example to write a member read from one archive to another under a different name.
I propose to support copy.replace():
zinfo = copy.replace(zf.getinfo('spam.txt'), filename='eggs.txt')
Attributes which are not replaced are inherited from the original object. As in the constructor, the file name is sanitized and the date is validated.
Linked PRs
- gh-155045
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the zipfile.ZipInfo entry point and the copy.replace() protocol; no source file or test is named in the issue. Compare replacement behavior with the ZipInfo constructor, including inherited attributes, filename sanitization, and date validation. Done means a ZipInfo member can be copied with selected attributes changed and used under a different filename.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100