Skip to content

gh-100609: Render an unnamed zipfile as ":zipfile:" in zipfile.Path - #160103

Merged
jaraco merged 1 commit into
python:mainfrom
jaraco:bugfix/gh-100609-path-str
Oct 21, 2026
Merged

jaraco merged 1 commit into
python:mainfrom
jaraco:bugfix/gh-100609-path-str

Conversation

@jaraco

@jaraco jaraco commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

str() of a zipfile.Path whose underlying zipfile has no filename — most
commonly one constructed from an io.BytesIO — raised TypeError, because
posixpath.join was handed None:

>>> import io, zipfile
>>> str(zipfile.Path(zipfile.ZipFile(io.BytesIO(), 'w')))
TypeError: expected str, bytes or os.PathLike object, not NoneType

Such a zipfile now renders its filename as :zipfile:, and the root of a
zipfile is no longer rendered with a trailing slash.

This synchronizes the fix from zipp
3.23.1
, extracted from a
larger zipfile.Path refresh so it can land and be backported as an isolated
bugfix.

🤖 Generated with Claude Code

….Path`

Synchronizes the fix from zipp 3.23.1. `str()` of a `zipfile.Path` whose
zipfile has no filename previously raised `TypeError`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jaraco

jaraco commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Merging as previously reviewed by @barneygale in zipp.

(sorry for the delay)

@jaraco
jaraco enabled auto-merge (squash) October 21, 2026 19:34
@jaraco
jaraco merged commit ba96fab into python:main Oct 21, 2026
62 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @jaraco for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @jaraco, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker ba96fab7348310651dcabadc1f4e954949e0e05a 3.14

@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160118 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160124 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 21, 2026
jaraco added a commit that referenced this pull request Oct 21, 2026
…e.Path` (GH-160103) (#160118)

gh-100609: Render an unnamed zipfile as ":zipfile:" in `zipfile.Path` (GH-160103)

Synchronizes the fix from zipp 3.23.1. `str()` of a `zipfile.Path` whose
zipfile has no filename previously raised `TypeError`.
(cherry picked from commit ba96fab)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
jaraco added a commit that referenced this pull request Oct 21, 2026
…e.Path` (GH-160103) (#160124)

Synchronizes the fix from zipp 3.23.1. `str()` of a `zipfile.Path` whose
zipfile has no filename previously raised `TypeError`.
(cherry picked from commit ba96fab)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant