Title: zipapp.get_interpreter() raises UnicodeDecodeError on invalid shebang bytes · Issue #158546 · python/cpython · GitHub
Open Graph Title: zipapp.get_interpreter() raises UnicodeDecodeError on invalid shebang bytes · Issue #158546 · python/cpython
X Title: zipapp.get_interpreter() raises UnicodeDecodeError on invalid shebang bytes · Issue #158546 · python/cpython
Description: zipapp.get_interpreter() raises UnicodeDecodeError when the shebang line contains bytes that aren't valid in shebang_encoding, instead of returning None. Reproducer: import zipapp, tempfile, os d = tempfile.mkdtemp() p = os.path.join(d, ...
Open Graph Description: zipapp.get_interpreter() raises UnicodeDecodeError when the shebang line contains bytes that aren't valid in shebang_encoding, instead of returning None. Reproducer: import zipapp, tempfile, os d =...
X Description: zipapp.get_interpreter() raises UnicodeDecodeError when the shebang line contains bytes that aren't valid in shebang_encoding, instead of returning None. Reproducer: import zipapp, tempfile, os...
Opengraph URL: https://github.com/python/cpython/issues/158546
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"zipapp.get_interpreter() raises UnicodeDecodeError on invalid shebang bytes","articleBody":"`zipapp.get_interpreter()` raises `UnicodeDecodeError` when the shebang\nline contains bytes that aren't valid in `shebang_encoding`, instead of\nreturning `None`.\n\nReproducer:\n\n import zipapp, tempfile, os\n d = tempfile.mkdtemp()\n p = os.path.join(d, \"a.pyz\")\n with open(p, \"wb\") as f:\n f.write(b\"#!\\xff\\xfe\\xff\\xfe\\nx\")\n print(repr(zipapp.get_interpreter(p)))\n\nActual:\n UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte\n\nExpected:\n None (treat undecodable shebang as \"no interpreter\")\n\nThe function already returns `None` for \"no shebang\", so returning\n`None` for an undecodable shebang is consistent. The CLI renders\n`None` as `\u003cnone>`.\n\nTested on: main.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-158555\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/Tony123-tech","@type":"Person","name":"Tony123-tech"},"datePublished":"2026-10-01T02:56:16Z","url":"https://github.com/python/cpython/issues/158546"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0a96c834-1393-6d30-70ec-aaa8bd9adce9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B61C:269AD9:35CFEB1:47D4671:6B02077D |
| html-safe-nonce | 5f949a14aaea5c769ca59017a08063f13e5ba096df062b64d4e899bc1a9722c6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjFDOjI2OUFEOTozNUNGRUIxOjQ3RDQ2NzE6NkIwMjA3N0QiLCJ2aXNpdG9yX2lkIjoiMjQ1MTA2OTExODE0NTc1OTEwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 376596b2d40bde9456f3ae40ceec4c6e86cf78f5947324f1658330ac8313361b |
| hovercard-subject-tag | issue:5656158356 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/158546/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bbc94da820659f1b6d65915b9b104ec89fe5cac8c589dd44c6d78adb16bace98/python/cpython/issues/158546 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bbc94da820659f1b6d65915b9b104ec89fe5cac8c589dd44c6d78adb16bace98/python/cpython/issues/158546 |
| og:image:alt | zipapp.get_interpreter() raises UnicodeDecodeError when the shebang line contains bytes that aren't valid in shebang_encoding, instead of returning None. Reproducer: import zipapp, tempfile, os d =... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Tony123-tech |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width