diff options
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 7fe4ccea55..24517e4764 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -261,14 +261,10 @@ Py_InitializeEx(int install_sigs) codeset = nl_langinfo(CODESET); if (codeset && *codeset) { - PyObject *enc = PyCodec_Encoder(codeset); - if (enc) { - codeset = strdup(codeset); - Py_DECREF(enc); - } else { - codeset = NULL; - PyErr_Clear(); - } + if (PyCodec_KnownEncoding(codeset)) + codeset = strdup(codeset); + else + codeset = NULL; } else codeset = NULL; |