summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-01 12:52:03 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-01 12:52:03 (GMT)
commit1511a5a3af26c99d73ae2933c74aed25ad1e8722 (patch)
tree94430d67cc060e1d386be82fd03d9d38e5d93c42 /Python
parent700835a57ec86a9904c1baf7570f99b934c33dff (diff)
parent90c0eb28c5ff1da76b258f9cf6a54abc6df19675 (diff)
downloadcpython-1511a5a3af26c99d73ae2933c74aed25ad1e8722.zip
cpython-1511a5a3af26c99d73ae2933c74aed25ad1e8722.tar.gz
cpython-1511a5a3af26c99d73ae2933c74aed25ad1e8722.tar.bz2
Merge issue #16218: Support non ascii characters in python launcher.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b1ca125..7c4fb4a 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;