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

bpo-32742: use infolist for zipfile.ZipFile.extractall#5472

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
peterbe wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
frompeterbe:use-infolist-for-zipefileextractall

Conversation

peterbe
Copy link

@peterbepeterbe commentedFeb 1, 2018
edited by bedevere-bot
Loading

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed thePSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please followthe steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

zipfile.ZipFile class's extractall method allows the list of members to beunset and if it is, defaults to the list of file *names* in the zip. Whensent to _extract_member that file name needs to be rewrapped as a ZipInfoinstance. The ZipInfo instances is already available inside extractall andcan be re-used.
@peterbepeterbeforce-pushed theuse-infolist-for-zipefileextractall branch fromd802d06 to1bb1df5CompareFebruary 1, 2018 15:23
@@ -1580,10 +1580,10 @@ def extractall(self, path=None, members=None, pwd=None):
"""Extract all members from the archive to the current working
directory. `path' specifies a different directory to extract to.
`members' is optional and must be a subset of the list returned
bynamelist().
byinfolist().
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think more doc is needed (here and in the ReST documentation) to make things clear. The code change in this PR does not change the function interface: people could pass a list of names or a list of ZipInfos before (thanks to extractall calling _extract_member which supports both), and they’re still able to do that after the change.

Maybe the doc could be explicit about these two options? Instead of naming directly namelist or infolist (and letting people think that members must be strings or must be ZipInfos), something like «members is optional and must contain strings or ZipInfo objects corresponding to valid entries (i.e. a subset of the list returned by namelist or infolist)».

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks. I juggled the idea but everything I attempted just got long winded and more confusing. Just sayinginfolist ornamelist is both correct and really brief. Too brief?

@merwok
Copy link
Member

Status: There is a question on the bug report about a behaviour change that needs to be addressed.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelAug 14, 2022
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 reviewstaleStale PR or inactive for long period of time.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@peterbe@the-knights-who-say-ni@merwok@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp