diff -r 84a3c5003510 Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst Tue Oct 25 20:20:09 2016 +0300 +++ b/Doc/using/cmdline.rst Wed Oct 26 02:47:59 2016 +0900 @@ -177,13 +177,18 @@ .. cmdoption:: -V --version Print the Python version number and exit. Example output could be:: - Python 3.0 + Python 3.5.2 + + When given twice, print more information about build, like:: + + Python 3.6.0b2+ (3.6:84a3c5003510+, Oct 26 2016, 02:33:55) + [GCC 6.2.0 20161005] .. _using-on-misc-options: Miscellaneous options ~~~~~~~~~~~~~~~~~~~~~ diff -r 84a3c5003510 Misc/python.man --- a/Misc/python.man Tue Oct 25 20:20:09 2016 +0300 +++ b/Misc/python.man Wed Oct 26 02:47:59 2016 +0900 @@ -191,13 +191,14 @@ (filename or built-in module) from which it is loaded. When given twice, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup 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 build. .TP .BI "\-W " argument Warning control. Python sometimes prints warning message to .IR sys.stderr . A typical warning message has the following form: .IB file ":" line ": " category ": " message. diff -r 84a3c5003510 Modules/main.c --- a/Modules/main.c Tue Oct 25 20:20:09 2016 +0300 +++ b/Modules/main.c Wed Oct 26 02:47:59 2016 +0900 @@ -71,12 +71,14 @@ -u : unbuffered binary stdout and stderr, stdin always buffered;\n\ also PYTHONUNBUFFERED=x\n\ see man page for details on internal buffering relating to '-u'\n\ -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 build\n\ + can be supplied multiple times to show more information\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\ -X opt : set implementation-specific option\n\ "; static const char usage_4[] = "\ @@ -509,13 +511,13 @@ } if (help) 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; } if (!Py_InspectFlag && (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') Py_InspectFlag = 1;