diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-28 05:48:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-28 06:04:44 +0300 |
commit | a0f2866a8e330d7f04dd2f330051b79e3eec98be (patch) | |
tree | 5516b4ef84a9ee32f64f9324d968ad11321b3bbf /source/blender/python | |
parent | 58fc1559767fcee4f708504518834c625c86bac7 (diff) |
Cleanup: update old comment for why we can't use PySys_SetArgv
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 894a9a69198..e8d309b8a50 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -349,17 +349,16 @@ void BPY_python_start(bContext *C, int argc, const char **argv) /* Initialize Python (also acquires lock). */ Py_Initialize(); - // PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */ - /* sigh, why do python guys not have a (char **) version anymore? */ + /* We could convert to #wchar_t then pass to #PySys_SetArgv (or use #PyConfig in Python 3.8+). + * However this risks introducing subtle changes in encoding that are hard to track down. + * + * So rely on #PyC_UnicodeFromByte since it's a tried & true way of getting paths + * that include non `utf-8` compatible characters, see: T20021. */ { - int i; PyObject *py_argv = PyList_New(argc); - for (i = 0; i < argc; i++) { - /* should fix bug T20021 - utf path name problems, by replacing - * PyUnicode_FromString, with this one */ + for (int i = 0; i < argc; i++) { PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i])); } - PySys_SetObject("argv", py_argv); Py_DECREF(py_argv); } |