馃寪 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

馃悰 fix(activate): preserve Unicode with legacy readers - #3402

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/python-activation-ascii
Oct 16, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
gaborbernat:fix/python-activation-ascii

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Applications that read activate_this.py with a legacy text encoding could change non-ASCII prompt and path values before executing the script. 馃悰 Generated string literals now use ASCII escape sequences, preserving their Unicode values across UTF-8, Latin-1 and CP932 decoding.

Keep generated literals independent of the text reader

The previous quoting used repr, which leaves printable non-ASCII characters in the source. The fix uses Python's ASCII string representation. Python reconstructs the original characters when it evaluates those literals.

Behavior changes

Generated literals contain escapes for non-ASCII characters. Their values after evaluation remain unchanged. Applications can continue using the documented runpy.run_path activation method.

@gaborbernat
gaborbernat merged commit 91e6595 into pypa:main Oct 16, 2026
76 checks passed
@gaborbernat gaborbernat added the security Fixes a vulnerability or hardens the supply chain, CI or release label Oct 16, 2026
@gaborbernat gaborbernat removed the security Fixes a vulnerability or hardens the supply chain, CI or release label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant