Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42043: Inheritance support for zipfile.Path for .parent, /, joinpath #22711

Closed
wants to merge 2 commits into from
Closed

Conversation

Conchylicultor
Copy link
Contributor

@Conchylicultor Conchylicultor commented Oct 15, 2020

Copying https://bugs.python.org/issue42043

Currently, zipfile.Path inheritance behavior is inconsistent with pathlib.Path:

class MyPath(zipfile.Path):
  pass


path = MyPath(zf)
path = path.joinpath('other')
assert isinstance(path, MyPath)  # Oups, type(path) is zipfile.Path

Calling parent, /,... should keep the class, as for pathlib.Path

Use case: I'm writing a wrapper around zipfile.Path which adds os.fspath compatibility (the file is extracted in a tmp dir when os.path.join, open,...).

https://bugs.python.org/issue42043

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@Conchylicultor

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@Conchylicultor
Copy link
Contributor Author

How long does it takes for the CLA to be updated ? I received the confirmation PDF through my mailbox, but https://check-python-cla.herokuapp.com/ indicates conchylicultor has not signed CLA ❌

@jaraco jaraco self-requested a review October 15, 2020 14:58
@jaraco
Copy link
Member

jaraco commented Oct 15, 2020

As mentioned in the bug, this issue is fixed in the backport 3.2.0 release. I'd like to port the tests from here and then port the updates to CPython. How's that sound?

@jaraco
Copy link
Member

jaraco commented Oct 15, 2020

Hmm. Interestingly, applying the test on zipp master fails, so perhaps it's not solved in 3.2.0.

edit: The test just needed a tweak from zipfile to zipp and it now passes.

@jaraco
Copy link
Member

jaraco commented Oct 15, 2020

Please have a look at #22716 and zipp 3.2.0 and later. Thanks for the bug report and patch.

@jaraco jaraco closed this Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants