bpo-20443: No longer make sys.argv[0] absolute for script (GH-17534) · python/cpython@a1a99b4 · GitHub
Skip to content

Commit a1a99b4

Browse files
authored
bpo-20443: No longer make sys.argv[0] absolute for script (GH-17534)
In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was specified on the command line. Revert this change, since most users expect sys.argv to be unmodified.
1 parent d219cc4 commit a1a99b4

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

Lib/test/test_cmd_line_script.py

Lines changed: 3 additions & 2 deletions

Lib/test/test_embed.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,9 @@ def test_preinit_parse_argv(self):
858858
preconfig = {
859859
'allocator': PYMEM_ALLOCATOR_DEBUG,
860860
}
861-
script_abspath = os.path.abspath('script.py')
862861
config = {
863-
'argv': [script_abspath],
864-
'run_filename': script_abspath,
862+
'argv': ['script.py'],
863+
'run_filename': os.path.abspath('script.py'),
865864
'dev_mode': 1,
866865
'faulthandler': 1,
867866
'warnoptions': ['default'],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In Python 3.9.0a1, sys.argv[0] was made an asolute path if a filename was
2+
specified on the command line. Revert this change, since most users expect
3+
sys.argv to be unmodified.

Python/initconfig.c

Lines changed: 0 additions & 4 deletions

0 commit comments

Comments
 (0)