This repository was archived by the owner on Feb 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed
Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -215,8 +215,10 @@ always available.
215215
216216.. data :: executable
217217
218- A string giving the name of the executable binary for the Python interpreter, on
219- systems where this makes sense.
218+ A string giving the absolute path of the executable binary for the Python
219+ interpreter, on systems where this makes sense. If Python is unable to retrieve
220+ the real path to its executable, :data: `sys.executable ` will be an empty string
221+ or ``None ``.
220222
221223
222224.. function :: exit([arg])
Original file line number Diff line number Diff line change @@ -471,6 +471,9 @@ def test_call_tracing(self):
471471 self .assertRaises (TypeError , sys .call_tracing , str , 2 )
472472
473473 def test_executable (self ):
474+ # sys.executable should be absolute
475+ self .assertEqual (os .path .abspath (sys .executable ), sys .executable )
476+
474477 # Issue #7774: Ensure that sys.executable is an empty string if argv[0]
475478 # has been set to an non existent program name and Python is unable to
476479 # retrieve the real program name
Original file line number Diff line number Diff line change @@ -509,6 +509,8 @@ Tests
509509Documentation
510510-------------
511511
512+ - Issue #13402: Document absoluteness of sys.executable.
513+
512514- Issue #13883: PYTHONCASEOK also works on OS X, OS/2, and RiscOS.
513515
514516- Issue #2134: The tokenize documentation has been clarified to explain why
Original file line number Diff line number Diff line change @@ -1093,7 +1093,7 @@ version_info -- version information as a named tuple\n\
10931093hexversion -- version information encoded as a single integer\n\
10941094copyright -- copyright notice pertaining to this interpreter\n\
10951095platform -- platform identifier\n\
1096- executable -- pathname of this Python interpreter\n\
1096+ executable -- absolute path of the executable binary of the Python interpreter\n\
10971097prefix -- prefix used to find the Python library\n\
10981098exec_prefix -- prefix used to find the machine-specific Python library\n\
10991099float_repr_style -- string indicating the style of repr() output for floats\n\
You can’t perform that action at this time.
0 commit comments