diff -r 803e5a732331 Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py Fri Nov 23 01:51:20 2012 +0200 +++ b/Lib/test/test_cmd_line.py Fri Nov 23 10:54:06 2012 +0200 @@ -389,7 +389,7 @@ def test_unknown_options(self): - rc, out, err = assert_python_failure('-z', __cleanenv=True) + rc, out, err = assert_python_failure('-z') self.assertIn(b'Unknown option', err) self.assertEqual(err.splitlines().count(b'Unknown option: -z'), 1) self.assertEqual(b'', out) diff -r 803e5a732331 Modules/main.c --- a/Modules/main.c Fri Nov 23 01:51:20 2012 +0200 +++ b/Modules/main.c Fri Nov 23 10:54:06 2012 +0200 @@ -334,6 +334,7 @@ /* Hash randomization needed early for all string operations (including -W and -X options). */ + _PyOS_opterr = 0; /* prevent printing the error in 1st pass */ while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { if (c == 'm' || c == 'c') { /* -c / -m is the last option: following arguments are diff -r 803e5a732331 Python/getopt.c --- a/Python/getopt.c Fri Nov 23 01:51:20 2012 +0200 +++ b/Python/getopt.c Fri Nov 23 10:54:06 2012 +0200 @@ -45,7 +45,7 @@ void _PyOS_ResetGetOpt(void) { - _PyOS_opterr = 0; /* prevent printing the error in 2nd loop in main.c */ + _PyOS_opterr = 1; _PyOS_optind = 1; _PyOS_optarg = NULL; opt_ptr = L"";