Commit 398356ba authored by Victor Stinner's avatar Victor Stinner

Improve error message if the command is not decodable

parent 7e44b6b0
...@@ -509,7 +509,10 @@ class SysModuleTest(unittest.TestCase): ...@@ -509,7 +509,10 @@ class SysModuleTest(unittest.TestCase):
p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE) p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
self.assertEqual(p.returncode, 1) 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): def test_sys_flags(self):
self.assertTrue(sys.flags) self.assertTrue(sys.flags)
......
...@@ -275,6 +275,7 @@ run_command(wchar_t *command, PyCompilerFlags *cf) ...@@ -275,6 +275,7 @@ run_command(wchar_t *command, PyCompilerFlags *cf)
return ret != 0; return ret != 0;
error: error:
PySys_WriteStderr("Unable to decode the command from the command line:\n");
PyErr_Print(); PyErr_Print();
return 1; return 1;
} }
......
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