[Python-checkins] cpython (3.2): main() now displays an error message before exiting if a command line argument

victor.stinner python-checkins at python.org
Fri Dec 16 23:47:05 CET 2011


http://hg.python.org/cpython/rev/3b17210f34d9
changeset: 74000:3b17210f34d9
branch: 3.2
parent: 73996:6a966179c73a
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Fri Dec 16 23:48:31 2011 +0100
summary:
 main() now displays an error message before exiting if a command line argument
cannot be decoded
files:
 Modules/python.c | 6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Modules/python.c b/Modules/python.c
--- a/Modules/python.c
+++ b/Modules/python.c
@@ -50,8 +50,12 @@
 #else
 argv_copy[i] = _Py_char2wchar(argv[i], NULL);
 #endif
- if (!argv_copy[i])
+ if (!argv_copy[i]) {
+ fprintf(stderr, "Fatal Python error: "
+ "unable to decode the command line argument #%i\n",
+ i + 1);
 return 1;
+ }
 argv_copy2[i] = argv_copy[i];
 }
 setlocale(LC_ALL, oldloc);
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /