changeset: 105275:fc6bb69cec05 branch: 3.6 parent: 105272:223967b49e49 user: INADA Naoki date: Mon Nov 21 20:57:14 2016 +0900 files: Doc/using/cmdline.rst Lib/test/test_cmd_line.py Misc/NEWS Misc/python.man Modules/main.c description: Issue #28532: Show sys.version when -V option is supplied twice diff -r 223967b49e49 -r fc6bb69cec05 Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst Mon Nov 21 01:59:39 2016 -0800 +++ b/Doc/using/cmdline.rst Mon Nov 21 20:57:14 2016 +0900 @@ -180,7 +180,12 @@ Print the Python version number and exit. Example output could be:: - Python 3.0 + Python 3.6.0b2+ + + When given twice, print more information about the build, like:: + + Python 3.6.0b2+ (3.6:84a3c5003510+, Oct 26 2016, 02:33:55) + [GCC 6.2.0 20161005] .. _using-on-misc-options: diff -r 223967b49e49 -r fc6bb69cec05 Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py Mon Nov 21 01:59:39 2016 -0800 +++ b/Lib/test/test_cmd_line.py Mon Nov 21 20:57:14 2016 +0900 @@ -43,7 +43,7 @@ def test_version(self): version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii") - for switch in '-V', '--version': + for switch in '-V', '--version', '-VV': rc, out, err = assert_python_ok(switch) self.assertFalse(err.startswith(version)) self.assertTrue(out.startswith(version)) diff -r 223967b49e49 -r fc6bb69cec05 Misc/NEWS --- a/Misc/NEWS Mon Nov 21 01:59:39 2016 -0800 +++ b/Misc/NEWS Mon Nov 21 20:57:14 2016 +0900 @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #28532: Show sys.version when -V option is supplied twice. + - Issue #28746: Fix the set_inheritable() file descriptor method on platforms that do not have the ioctl FIOCLEX and FIONCLEX commands. diff -r 223967b49e49 -r fc6bb69cec05 Misc/python.man --- a/Misc/python.man Mon Nov 21 01:59:39 2016 -0800 +++ b/Misc/python.man Mon Nov 21 20:57:14 2016 +0900 @@ -194,7 +194,8 @@ at exit. .TP .B \-V ", " \-\-version -Prints the Python version number of the executable and exits. +Prints the Python version number of the executable and exits. When given +twice, print more information about the build. .TP .BI "\-W " argument Warning control. Python sometimes prints warning message to diff -r 223967b49e49 -r fc6bb69cec05 Modules/main.c --- a/Modules/main.c Mon Nov 21 01:59:39 2016 -0800 +++ b/Modules/main.c Mon Nov 21 20:57:14 2016 +0900 @@ -74,6 +74,7 @@ -v : verbose (trace import statements); also PYTHONVERBOSE=x\n\ can be supplied multiple times to increase verbosity\n\ -V : print the Python version number and exit (also --version)\n\ + when given twice, print more information about the build\n\ -W arg : warning control; arg is action:message:category:module:lineno\n\ also PYTHONWARNINGS=arg\n\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ @@ -512,7 +513,7 @@ return usage(0, argv[0]); if (version) { - printf("Python %s\n", PY_VERSION); + printf("Python %s\n", version >= 2 ? Py_GetVersion() : PY_VERSION); return 0; }