summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-01 14:51:14 +0200
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-01 14:51:14 +0200
commitf5c8faafee817beaa30d7ac28c1e49bc2ffe3b48 (patch)
treee6f87cc84c101007faa09ff071338c6a418029eb /Python/pythonrun.c
parent7797419eb505110d70d2fee3bfe18c149d21dbe9 (diff)
downloadcpython-f5c8faafee817beaa30d7ac28c1e49bc2ffe3b48.tar.gz
Issue #16218: Support non ascii characters in python launcher.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b1ca125781..7c4fb4a3c9 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1358,16 +1358,21 @@ static set_main_loader(PyObject *d, const char *filename, const char *loader_nam
{
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;