Skip to content

Pylauncher does not correctly detect a BOM when searching for the shebang #131020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chris-eibl opened this issue Mar 9, 2025 · 6 comments
Closed
Labels
build The build process and cross-build OS-windows type-bug An unexpected behavior, bug, or error

Comments

@chris-eibl
Copy link
Member

chris-eibl commented Mar 9, 2025

Bug report

Bug description:

This is due to

cpython/PC/launcher2.c

Lines 1080 to 1081 in 475f933

if (bytesRead > 3 && *b == 0xEF) {
if (*++b == 0xBB && *++b == 0xBF) {

for wich clang-cl creates the following warnings:

1>..\PC\launcher2.c(1080,29): warning : result of comparison of constant 239 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
1>..\PC\launcher2.c(1081,34): warning : result of comparison of constant 191 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
1>..\PC\launcher2.c(1081,18): warning : result of comparison of constant 187 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

@StanFromIreland

This comment has been minimized.

@picnixz

This comment has been minimized.

@picnixz picnixz closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2025
@StanFromIreland

This comment has been minimized.

@picnixz

This comment has been minimized.

@picnixz picnixz reopened this Mar 10, 2025
@chris-eibl chris-eibl changed the title Pylauncher does not correctly detect a BOM Pylauncher does not correctly detect a BOM when searching for the shebang Mar 10, 2025
@picnixz
Copy link
Member

picnixz commented Mar 10, 2025

Reopening as it appeared that this wasn't true duplicate although the errors were similar.

zooba pushed a commit that referenced this issue Mar 10, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 10, 2025
… searching for the shebang (pythonGH-131021)

(cherry picked from commit 36ef3bf)

Co-authored-by: Chris Eibl <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 10, 2025
… searching for the shebang (pythonGH-131021)

(cherry picked from commit 36ef3bf)

Co-authored-by: Chris Eibl <[email protected]>
zooba pushed a commit that referenced this issue Mar 10, 2025
…n searching for the shebang (GH-131021) (#131047)

gh-131020: py.exe launcher does not correctly detect a BOM when searching for the shebang (GH-131021)
(cherry picked from commit 36ef3bf)

Co-authored-by: Chris Eibl <[email protected]>
zooba pushed a commit that referenced this issue Mar 10, 2025
…hing for the shebang (GH-131021)

(cherry picked from commit 36ef3bf)

Co-authored-by: Chris Eibl <[email protected]>
@picnixz
Copy link
Member

picnixz commented Mar 12, 2025

Closing since it was completed. Thanks for the report and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants