Skip to content

Fix profiling scripts with a UTF-8 BOM - #1092

Merged
emeryberger merged 1 commit into
plasma-umass:masterfrom
mameikagou:fix/1091-utf8-bom
Aug 27, 2026
Merged

Fix profiling scripts with a UTF-8 BOM#1092
emeryberger merged 1 commit into
plasma-umass:masterfrom
mameikagou:fix/1091-utf8-bom

Conversation

@mameikagou

Copy link
Copy Markdown
Contributor

Fixes #1091.

Scalene reads the entry script as text, so a leading UTF-8 BOM reaches compile() and raises a SyntaxError. Use utf-8-sig to consume the BOM while preserving ordinary UTF-8 decoding.

Add real CLI regressions for scripts with a BOM, plain UTF-8, and non-ASCII UTF-8 content.

Validation on Python 3.12:

  • The BOM script fails before the fix and executes successfully afterward.
  • Eight focused tests pass (BOM/non-ASCII CLI regressions and the existing main-execution test); mypy scalene and ruff check scalene pass.
  • The full test suite was not completed locally; the bounded run hit its time limit.

@emeryberger
emeryberger merged commit 05731c0 into plasma-umass:master Aug 27, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Byte Order Mark

2 participants