not to stderr. Patch by Berker Peksag and Michael Dickens.
def test_version(self):
version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
- rc, out, err = assert_python_ok('-V')
- self.assertTrue(err.startswith(version))
+ for switch in '-V', '--version':
+ rc, out, err = assert_python_ok(switch)
+ self.assertFalse(err.startswith(version))
+ self.assertTrue(out.startswith(version))
def test_verbose(self):
# -v causes imports to write to stderr. If the write to
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
PyModule_GetDef() returns an error.
return usage(0, argv[0]);
if (version) {
- fprintf(stderr, "Python %s\n", PY_VERSION);
+ printf("Python %s\n", PY_VERSION);
return 0;
}