[Python-checkins] r84185 - in python/branches/py3k: Lib/test/test_sys.py Modules/main.c
victor.stinner
python-checkins at python.org
Thu Aug 19 00:23:23 CEST 2010
Author: victor.stinner
Date: Thu Aug 19 00:23:22 2010
New Revision: 84185
Log:
Improve error message if the command is not decodable
Modified:
python/branches/py3k/Lib/test/test_sys.py
python/branches/py3k/Modules/main.c
Modified: python/branches/py3k/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sys.py (original)
+++ python/branches/py3k/Lib/test/test_sys.py Thu Aug 19 00:23:22 2010
@@ -509,7 +509,10 @@
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)
Modified: python/branches/py3k/Modules/main.c
==============================================================================
--- python/branches/py3k/Modules/main.c (original)
+++ python/branches/py3k/Modules/main.c Thu Aug 19 00:23:22 2010
@@ -275,6 +275,7 @@
return ret != 0;
error:
+ PySys_WriteStderr("Unable to decode the command from the command line:\n");
PyErr_Print();
return 1;
}
More information about the Python-checkins
mailing list