Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 80155:02d25098ad57 3.3
Issue #16218: Support non ascii characters in python launcher.
Patch by Serhiy Storchaka.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 01 Nov 2012 14:51:14 +0200 |
| parents | c3539eb02470 |
| children | 215297665098 |
line wrap: on
line diff
--- a/Python/pythonrun.c Thu Nov 01 13:43:31 2012 +0200 +++ b/Python/pythonrun.c Thu Nov 01 14:51:14 2012 +0200 @@ -1358,16 +1358,21 @@ { PyInterpreterState *interp; PyThreadState *tstate; - PyObject *loader_type, *loader; + PyObject *filename_obj, *loader_type, *loader; int result = 0; + + filename_obj = PyUnicode_DecodeFSDefault(filename); + if (filename_obj == NULL) + return -1; /* Get current thread state and interpreter pointer */ tstate = PyThreadState_GET(); interp = tstate->interp; loader_type = PyObject_GetAttrString(interp->importlib, loader_name); if (loader_type == NULL) { + Py_DECREF(filename_obj); return -1; } - loader = PyObject_CallFunction(loader_type, "ss", "__main__", filename); + loader = PyObject_CallFunction(loader_type, "sN", "__main__", filename_obj); Py_DECREF(loader_type); if (loader == NULL) { return -1;
