summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/Modules/main.c b/Modules/main.c
index ed84aa0..a820a9e 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -6,6 +6,7 @@
#include <locale.h>
#ifdef __VMS
+#error "PEP 11: VMS is now unsupported, code will be removed in Python 3.4"
#include <unixlib.h>
#endif
@@ -102,7 +103,8 @@ static char *usage_5 =
"PYTHONHOME : alternate <prefix> directory (or <prefix>%c<exec_prefix>).\n"
" The default module search path uses %s.\n"
"PYTHONCASEOK : ignore case in 'import' statements (Windows).\n"
-"PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\
+"PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n"
+"PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n\
";
static char *usage_6 = "\
PYTHONHASHSEED: if this variable is set to ``random``, the effect is the same \n\
@@ -507,16 +509,13 @@ Py_Main(int argc, wchar_t **argv)
/* Use utf-8 on Mac OS X */
unicode = PyUnicode_FromString(p);
#else
- wchar_t *wchar;
- size_t len;
- wchar = _Py_char2wchar(p, &len);
- if (wchar == NULL)
- continue;
- unicode = PyUnicode_FromWideChar(wchar, len);
- PyMem_Free(wchar);
+ unicode = PyUnicode_DecodeLocale(p, "surrogateescape");
#endif
- if (unicode == NULL)
+ if (unicode == NULL) {
+ /* ignore errors */
+ PyErr_Clear();
continue;
+ }
PySys_AddWarnOptionUnicode(unicode);
Py_DECREF(unicode);
}
@@ -591,7 +590,6 @@ Py_Main(int argc, wchar_t **argv)
if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') {
wchar_t* buffer;
size_t len = strlen(p);
- size_t r;
buffer = malloc(len * sizeof(wchar_t));
if (buffer == NULL) {
@@ -599,7 +597,7 @@ Py_Main(int argc, wchar_t **argv)
"not enough memory to copy PYTHONEXECUTABLE");
}
- r = mbstowcs(buffer, p, len);
+ mbstowcs(buffer, p, len);
Py_SetProgramName(buffer);
/* buffer is now handed off - do not free */
} else {