Skip to content

Commit c334626

Browse files
authored
Feature: sys.orig_argv (#4048)
1 parent 3630cfa commit c334626

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/test/test_sys.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,6 @@ def g456():
484484
leave_g.set()
485485
t.join()
486486

487-
# TODO: RUSTPYTHON, AttributeError: module 'sys' has no attribute 'orig_argv'
488-
@unittest.expectedFailure
489487
def test_attributes(self):
490488
self.assertIsInstance(sys.api_version, int)
491489
self.assertIsInstance(sys.argv, list)
@@ -1006,8 +1004,6 @@ def test__enablelegacywindowsfsencoding(self):
10061004
out = out.decode('ascii', 'replace').rstrip()
10071005
self.assertEqual(out, 'mbcs replace')
10081006

1009-
# TODO: RUSTPYTHON, subprocess.CalledProcessError: Command ... returned non-zero exit status 1.
1010-
@unittest.expectedFailure
10111007
def test_orig_argv(self):
10121008
code = textwrap.dedent('''
10131009
import sys

vm/src/stdlib/sys.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ mod sys {
217217
Vec::new()
218218
}
219219

220+
#[pyattr]
221+
fn orig_argv(vm: &VirtualMachine) -> Vec<PyObjectRef> {
222+
env::args().map(|arg| vm.ctx.new_str(arg).into()).collect()
223+
}
224+
220225
#[pyattr]
221226
fn path(vm: &VirtualMachine) -> Vec<PyObjectRef> {
222227
vm.state

0 commit comments

Comments
 (0)