Skip to content

[3.14] gh-100609: Render an unnamed zipfile as ":zipfile:" in zipfile.Path (GH-160103) - #160124

Merged
jaraco merged 1 commit into
python:3.14from
jaraco:backport-ba96fab-3.14
Oct 21, 2026
Merged

jaraco merged 1 commit into
python:3.14from
jaraco:backport-ba96fab-3.14

Conversation

@jaraco

@jaraco jaraco commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Manual backport of #160103 to 3.14; miss-islington could not apply it cleanly.

The conflict: zipfile/_path/_functools.py does not exist on 3.14 — it arrived with the zipp 3.23 refresh in gh-135276, which landed in 3.15. Rather than introduce a new private module and a none_as helper on a maintenance branch for a single call site, __str__ tests for None inline:

    def __str__(self):
        root = self.root.filename
        if root is None:
            root = ':zipfile:'
        return posixpath.join(root, self.at) if self.at else root

Note this cannot be shortened to self.root.filename or ':zipfile:': a zipfile whose filename is the empty string must keep rendering as empty, which test_unsupported_names covers.

The two new tests also use this branch's self.fixtures.enter_context idiom rather than self.enterContext, since gh-81954 — which introduced the enterContext style in this file along with a ResourceWarning on implicit ZipFile close — is main-only.

Verified on 3.14: test_zipfile passes (388 tests), including test_unsupported_names and the two new tests.

(cherry picked from commit ba96fab)

Co-authored-by: Jason R. Coombs jaraco@jaraco.com

🤖 Generated with Claude Code

…zipfile.Path` (pythonGH-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
jaraco enabled auto-merge (squash) October 21, 2026 22:04
@jaraco
jaraco merged commit ba0e4a4 into python:3.14 Oct 21, 2026
53 of 54 checks passed
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