Skip to content

gh-158546: Treat undecodable zipapp shebangs as absent - #158555

Open
rupayon123 wants to merge 1 commit into
python:mainfrom
rupayon123:fix-zipapp-undecodable-shebang-20261001
Open

rupayon123 wants to merge 1 commit into
python:mainfrom
rupayon123:fix-zipapp-undecodable-shebang-20261001

Conversation

@rupayon123

@rupayon123 rupayon123 commented Oct 1, 2026 •

Copy link
Copy Markdown

Summary

Treat a shebang line that cannot be decoded using zipapp.shebang_encoding as having no interpreter. Add a regression test for malformed shebang bytes and a Library NEWS entry.

Fixes #158546

Testing

  • PYTHONPATH=Lib python3.15 -m unittest test.test_zipapp — 36 tests passed.
  • Reproduced the reported UnicodeDecodeError against the unmodified source before the fix.
  • git diff --check — passed.

The full CPython build/test matrix was not run; this change is limited to the pure-Python zipapp module and its tests.

AI assistance was used to inspect the issue and code, draft the focused change and test, and review the diff. I reproduced the original behavior and ran the tests listed above.

@python-cla-bot

python-cla-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zipapp.get_interpreter() raises UnicodeDecodeError on invalid shebang bytes

1 participant