Skip to content

Inconsistent behavior of zipapp.create_archive #156568

Open

Description

@eoan-ermine

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 b0c9fc3

Operating systems tested on:

Linux

Linked PRs

Activity

  1. changed the title [-]Inconsistent behavior of zipapp.create_archive[/-] [+]Inconsistent behavior of `zipapp.create_archive`[/+] on Aug 29, 2026
  2. eoan-ermine commented on Aug 29, 2026

    @eoan-ermine
    ContributorAuthor

    If this behavior is considered a bug, I’d be happy to submit a fix.

  3. deleted a comment from on Aug 29, 2026
  4. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Aug 29, 2026
  5. added a commit that references this issue on Sep 6, 2026
  6. added 3 commits that reference this issue on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions