Skip to content

gh-130120: Prevent str(zipfile.Path) from raising exception on io.BytesIO-input - #130381

Closed
yngvem wants to merge 4 commits into
python:mainfrom
yngvem:fix-zipfile-path
Closed

yngvem wants to merge 4 commits into
python:mainfrom
yngvem:fix-zipfile-path

Conversation

@yngvem

@yngvem yngvem commented Feb 20, 2025 •

Copy link
Copy Markdown
Contributor

Here are some small updates to zipfile.Path to prevent them from raising exceptions when Path-objects that are based on in-memory zipfiles are printed.

I set the printed filename to :memory: to mirror the behaviour of in-memory sqlite3 databases. However, it may also make sense to set the name to \0 (or include \0 in the name) to make it abundantly clear that this is no file.

@jaraco jaraco left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As you've noted, there are some design decisions to make. I'm going to take those back to the issue to discuss.

Comment thread Lib/test/test_zipfile/_path/test_path.py
Comment thread Lib/test/test_zipfile/_path/test_path.py
@bedevere-app

bedevere-app Bot commented Feb 27, 2025

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@jaraco

jaraco commented Feb 27, 2025

Copy link
Copy Markdown
Member

Given the history I've recently been reminded of in #100609, I'm going to close this PR. Hang onto the branch, though, in case we decide to go with something like you've drafted. Thanks for understanding.

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.

2 participants