File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -202,8 +202,10 @@ always available.
202202
203203.. data :: executable
204204
205- A string giving the name of the executable binary for the Python interpreter, on
206- systems where this makes sense.
205+ A string giving the absolute path of the executable binary for the Python
206+ interpreter, on systems where this makes sense. If Python is unable to retrieve
207+ the real path to its executable, :data: `sys.executable ` will be an empty string
208+ or ``None ``.
207209
208210
209211.. function :: exit([arg])
Original file line number Diff line number Diff line change @@ -532,6 +532,9 @@ def test_ioencoding(self):
532532 self .assertEqual (out , b'?' )
533533
534534 def test_executable (self ):
535+ # sys.executable should be absolute
536+ self .assertEqual (os .path .abspath (sys .executable ), sys .executable )
537+
535538 # Issue #7774: Ensure that sys.executable is an empty string if argv[0]
536539 # has been set to an non existent program name and Python is unable to
537540 # retrieve the real program name
Original file line number Diff line number Diff line change @@ -454,6 +454,8 @@ Extension Modules
454454Documentation
455455-------------
456456
457+ - Issue #13402: Document absoluteness of sys.executable.
458+
457459- Issue #13883: PYTHONCASEOK also used on OS X and OS/2.
458460
459461- Issue #12949: Document the kwonlyargcount argument for the PyCode_New
Original file line number Diff line number Diff line change @@ -1263,7 +1263,7 @@ version_info -- version information as a named tuple\n\
12631263hexversion -- version information encoded as a single integer\n\
12641264copyright -- copyright notice pertaining to this interpreter\n\
12651265platform -- platform identifier\n\
1266- executable -- pathname of this Python interpreter\n\
1266+ executable -- absolute path of the executable binary of the Python interpreter\n\
12671267prefix -- prefix used to find the Python library\n\
12681268exec_prefix -- prefix used to find the machine-specific Python library\n\
12691269float_repr_style -- string indicating the style of repr() output for floats\n\
You can’t perform that action at this time.
0 commit comments