summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-02-02 19:23:15 (GMT)
committerPetri Lehtinen <petri@digip.org>2012-02-02 19:23:15 (GMT)
commit4b0eab62f04fc2e738b1bff1d170c7f6f96c1920 (patch)
tree4b862ab67650ae543db018d415b4916e87ca6e8a
parentf854799d8438d66d1997e71cb2ea821e29d33472 (diff)
parent9713321f46769f41f653a752ec348cec766e633e (diff)
downloadcpython-4b0eab62f04fc2e738b1bff1d170c7f6f96c1920.zip
cpython-4b0eab62f04fc2e738b1bff1d170c7f6f96c1920.tar.gz
cpython-4b0eab62f04fc2e738b1bff1d170c7f6f96c1920.tar.bz2
Merge branch 3.2
Closes #13402.
-rw-r--r--Doc/library/sys.rst6
-rw-r--r--Lib/test/test_sys.py3
-rw-r--r--Misc/NEWS2
-rw-r--r--Python/sysmodule.c2
4 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 72414f6..c2b7423 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -202,8 +202,10 @@ always available.
.. data:: executable
- A string giving the name of the executable binary for the Python interpreter, on
- systems where this makes sense.
+ A string giving the absolute path of the executable binary for the Python
+ interpreter, on systems where this makes sense. If Python is unable to retrieve
+ the real path to its executable, :data:`sys.executable` will be an empty string
+ or ``None``.
.. function:: exit([arg])
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 6dc0e42..527e762 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -542,6 +542,9 @@ class SysModuleTest(unittest.TestCase):
self.assertEqual(out, b'?')
def test_executable(self):
+ # sys.executable should be absolute
+ self.assertEqual(os.path.abspath(sys.executable), sys.executable)
+
# Issue #7774: Ensure that sys.executable is an empty string if argv[0]
# has been set to an non existent program name and Python is unable to
# retrieve the real program name
diff --git a/Misc/NEWS b/Misc/NEWS
index b005e93..f00738b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2147,6 +2147,8 @@ C-API
Documentation
-------------
+- Issue #13402: Document absoluteness of sys.executable.
+
- Issue #13883: PYTHONCASEOK also works on OS X.
- Issue #12949: Document the kwonlyargcount argument for the PyCode_New
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index d1517d3..955219f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1257,7 +1257,7 @@ Static objects:\n\
builtin_module_names -- tuple of module names built into this interpreter\n\
copyright -- copyright notice pertaining to this interpreter\n\
exec_prefix -- prefix used to find the machine-specific Python library\n\
-executable -- pathname of this Python interpreter\n\
+executable -- absolute path of the executable binary of the Python interpreter\n\
float_info -- a struct sequence with information about the float implementation.\n\
float_repr_style -- string indicating the style of repr() output for floats\n\
hexversion -- version information encoded as a single integer\n\