Repository navigation
🐛 fix(xonsh): retain environment path bytes - #3671
Merged
Merged
Conversation
gaborbernat
force-pushed
the
fix/xonsh-legacy-path-3631
branch
from
November 20, 2026 07:32
1273999 to
4871123
Compare
gaborbernat
force-pushed
the
fix/xonsh-legacy-path-3631
branch
2 times, most recently
from
November 20, 2026 09:09
158c5a4 to
78961d9
Compare
Xonsh re-encodes the embedded destination with its session's filesystem codec. After creation under UTF-8, activation under another codec could name a different directory in PATH. Record the destination bytes and decode them in the sourcing session, as the Tcl and Tk paths already do. Fixes pypa#3631
gaborbernat
force-pushed
the
fix/xonsh-legacy-path-3631
branch
from
November 20, 2026 10:43
78961d9 to
72c93f4
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 11:17
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Xonsh activation script embedded the destination as Unicode. An environment created under UTF-8 could then activate a different byte-spelled directory when Xonsh ran under ISO-8859-1, putting that directory first on
PATH. The script now records non-ASCII destination paths as bytes and decodes them in the sourcing session. Fixes #3631.Xonsh re-encoded the destination
Python converts environment paths using the process filesystem codec. At generation time,
ActivationSelector.createpermits shell scripts only when the destination's filesystem bytes match its UTF-8 encoding. For non-ASCII paths, the Xonsh substitution now embeds those bytes for__VIRTUAL_ENV__as it already did for Tcl and Tk paths.os.fsdecodegives the sourcing session a string that encodes back to the original bytes.Behavior changes
On POSIX, Xonsh activation keeps the created destination in
VIRTUAL_ENV,PATH, andPKG_CONFIG_PATHwhen the sourcing session uses another filesystem codec. Windows continues to embed the Unicode path. Existing environments need their activation scripts regenerated to receive the fix.Reported by oss-scanner: ANT-2026-PQW92I38.