Inconsistent behavior of `zipapp.create_archive`
Open
Nobody has claimed this yet.
stdlib
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
Currently, zipapp.create_archive makes the target application archive executable only if target is a str. (see snippets bellow).
I think the target application archive should be made executable also when target is os.PathLike.
# source.py
print("Hello from pyz")
# bug_reproduction.py
import os
import pathlib
import zipapp
import sys
zipapp.create_archive("source.py", "source.pyz")
zipapp.create_archive(
pathlib.Path("source.pyz"),
pathlib.Path("copy.pyz"),
interpreter=sys.executable,
)
zipapp.create_archive("source.pyz", "copy2.pyz", interpreter=sys.executable)
assert os.access("copy2.pyz", os.X_OK) # Passes
assert os.access("copy.pyz", os.X_OK) # Fails
CPython versions tested on:
CPython main branch, commit b0c9fc37dd0ed60456313600e6a01478308f195e
Operating systems tested on:
Linux
Linked PRs
- gh-156569
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the zipapp.create_archive entry point and reproduce the behavior from the issue on Linux with string and pathlib.Path targets. Done means PathLike targets produce executable archives consistently with string targets; the issue's linked PR indicates this work is already underway.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100