changeset: 74727:8b591a86fc91 parent: 74726:d2ab2e4ce3ae parent: 74725:fdcda5b74317 user: Petri Lehtinen date: Thu Feb 02 21:23:15 2012 +0200 files: Doc/library/sys.rst Lib/test/test_sys.py Misc/NEWS Python/sysmodule.c description: Merge branch 3.2 Closes #13402. diff -r d2ab2e4ce3ae -r 8b591a86fc91 Doc/library/sys.rst --- a/Doc/library/sys.rst Thu Feb 02 17:17:36 2012 +0200 +++ b/Doc/library/sys.rst Thu Feb 02 21:23:15 2012 +0200 @@ -202,8 +202,10 @@ .. 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 -r d2ab2e4ce3ae -r 8b591a86fc91 Lib/test/test_sys.py --- a/Lib/test/test_sys.py Thu Feb 02 17:17:36 2012 +0200 +++ b/Lib/test/test_sys.py Thu Feb 02 21:23:15 2012 +0200 @@ -542,6 +542,9 @@ 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 -r d2ab2e4ce3ae -r 8b591a86fc91 Misc/NEWS --- a/Misc/NEWS Thu Feb 02 17:17:36 2012 +0200 +++ b/Misc/NEWS Thu Feb 02 21:23:15 2012 +0200 @@ -2147,6 +2147,8 @@ 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 -r d2ab2e4ce3ae -r 8b591a86fc91 Python/sysmodule.c --- a/Python/sysmodule.c Thu Feb 02 17:17:36 2012 +0200 +++ b/Python/sysmodule.c Thu Feb 02 21:23:15 2012 +0200 @@ -1257,7 +1257,7 @@ 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\

AltStyle によって変換されたページ (->オリジナル) /