Skip to content

gh-156568: Make zipapp archives executable with PathLike targets - #156569

Open
eoan-ermine wants to merge 1 commit into
python:mainfrom
eoan-ermine:gh-156568
Open

gh-156568: Make zipapp archives executable with PathLike targets#156569
eoan-ermine wants to merge 1 commit into
python:mainfrom
eoan-ermine:gh-156568

Conversation

@eoan-ermine

@eoan-ermine eoan-ermine commented Aug 29, 2026

Copy link
Copy Markdown

Fix zipapp.create_archive() not setting the executable bit for PathLike targets.

@python-cla-bot

python-cla-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@eoan-ermine

Copy link
Copy Markdown
Author

@pfmoore fyi

@aisk aisk added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 29, 2026
@@ -0,0 +1,2 @@
:func:`zipapp.create_archive` now correctly sets the executable bit on the
target archive when the target is a path-like object.

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.

Suggested change
target archive when the target is a path-like object.
target archive when copying a zipapp where the target is a path-like object.

Comment thread Lib/test/test_zipapp.py
source.mkdir()
(source / '__main__.py').touch()
target = self.tmpdir / 'source.pyz'
zipapp.create_archive(source, target, interpreter='python')

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.

Needs a comment explaining why we are creating the zipapp twice. Something like:

Copying an archive uses a different code path than creating one from scratch. Ensure that the executable bit is set even if the target is a path-like object.

Maybe also add a reference to the bug report.

In theory we should have checks for both the str and the os.PathLike cases, but that feels like overkill.

@bedevere-app

bedevere-app Bot commented Aug 29, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants