diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-18 22:23:22 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-08-18 22:23:22 (GMT) |
commit | 398356baaa60b1e46ce45ec7b8ae8ac28ca53091 (patch) | |
tree | 3db53918af906f39b003f6cce1999154e5464999 | |
parent | 7e44b6b0c5c5a8078ae2ae2f86d6d948c9ebf3e4 (diff) | |
download | cpython-398356baaa60b1e46ce45ec7b8ae8ac28ca53091.zip cpython-398356baaa60b1e46ce45ec7b8ae8ac28ca53091.tar.gz cpython-398356baaa60b1e46ce45ec7b8ae8ac28ca53091.tar.bz2 |
Improve error message if the command is not decodable
-rw-r--r-- | Lib/test/test_sys.py | 5 | ||||
-rw-r--r-- | Modules/main.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index d2f5b85..f146d71 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -509,7 +509,10 @@ class SysModuleTest(unittest.TestCase): p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 1) - self.assertIn(br"UnicodeEncodeError:", stderr) + lines = stderr.splitlines() + self.assertGreaterEqual(len(lines), 2) + self.assertEqual(b"Unable to decode the command from the command line:", lines[0]) + self.assertIn(br"UnicodeEncodeError:", lines[1]) def test_sys_flags(self): self.assertTrue(sys.flags) diff --git a/Modules/main.c b/Modules/main.c index d129aba..a5c8905 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -275,6 +275,7 @@ run_command(wchar_t *command, PyCompilerFlags *cf) return ret != 0; error: + PySys_WriteStderr("Unable to decode the command from the command line:\n"); PyErr_Print(); return 1; } |