Commit e3ed4edb authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #18338: `python --version` now prints version string to stdout, and

not to stderr.  Patch by Berker Peksag and Michael Dickens.
parent e173d012
...@@ -41,8 +41,10 @@ class CmdLineTest(unittest.TestCase): ...@@ -41,8 +41,10 @@ class CmdLineTest(unittest.TestCase):
def test_version(self): def test_version(self):
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii") version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
rc, out, err = assert_python_ok('-V') for switch in '-V', '--version':
self.assertTrue(err.startswith(version)) rc, out, err = assert_python_ok(switch)
self.assertFalse(err.startswith(version))
self.assertTrue(out.startswith(version))
def test_verbose(self): def test_verbose(self):
# -v causes imports to write to stderr. If the write to # -v causes imports to write to stderr. If the write to
......
...@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1? ...@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #18338: `python --version` now prints version string to stdout, and
not to stderr. Patch by Berker Peksag and Michael Dickens.
- Issue #18426: Fix NULL pointer dereference in C extension import when - Issue #18426: Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error. PyModule_GetDef() returns an error.
......
...@@ -500,7 +500,7 @@ Py_Main(int argc, wchar_t **argv) ...@@ -500,7 +500,7 @@ Py_Main(int argc, wchar_t **argv)
return usage(0, argv[0]); return usage(0, argv[0]);
if (version) { if (version) {
fprintf(stderr, "Python %s\n", PY_VERSION); printf("Python %s\n", PY_VERSION);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment