comparison Modules/python.c @ 65275:e9ea09787a35

main(): catch PyUnicode_FromString() failure (exit)
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 13 Oct 2010 22:36:16 +0000
parents 3335edce48a3
children 49df778889e6
comparison
equal deleted inserted replaced
65271:a4a6d823ff89 65275:e9ea09787a35
42 setlocale(LC_ALL, ""); 42 setlocale(LC_ALL, "");
43 for (i = 0; i < argc; i++) { 43 for (i = 0; i < argc; i++) {
44 #ifdef __APPLE__ 44 #ifdef __APPLE__
45 /* Use utf-8 on Mac OS X */ 45 /* Use utf-8 on Mac OS X */
46 PyObject *unicode = PyUnicode_FromString(argv[i]); 46 PyObject *unicode = PyUnicode_FromString(argv[i]);
47 if (!unicode)
48 return 1;
47 argv_copy[i] = PyUnicode_AsWideCharString(unicode, NULL); 49 argv_copy[i] = PyUnicode_AsWideCharString(unicode, NULL);
48 Py_DECREF(unicode); 50 Py_DECREF(unicode);
49 #else 51 #else
50 argv_copy[i] = _Py_char2wchar(argv[i]); 52 argv_copy[i] = _Py_char2wchar(argv[i]);
51 #endif 53 #endif