Skip to content

Commit a8f1e26

Browse files
committed
fix hidden var
1 parent 431a043 commit a8f1e26

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Lib/test/test_ntpath.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,6 @@ def check(value, expected):
10361036
check('%spam%bar', '%sbar' % nonascii)
10371037
check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
10381038

1039-
# TODO: RUSTPYTHON
1040-
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
10411039
def test_expanduser(self):
10421040
tester('ntpath.expanduser("test")', 'test')
10431041

crates/vm/src/stdlib/nt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ pub(crate) mod module {
125125
let environ = vm.ctx.new_dict();
126126

127127
for (key, value) in env::vars() {
128+
// Skip hidden Windows environment variables (e.g., =C:, =D:, =ExitCode)
129+
// These are internal cmd.exe bookkeeping variables that store per-drive
130+
// current directories. They cannot be modified via _wputenv() and should
131+
// not be exposed to Python code.
132+
if key.starts_with('=') {
133+
continue;
134+
}
128135
environ.set_item(&key, vm.new_pyobj(value), vm).unwrap();
129136
}
130137
environ

0 commit comments

Comments
 (0)