From a0f2866a8e330d7f04dd2f330051b79e3eec98be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 28 Oct 2020 13:48:02 +1100 Subject: Cleanup: update old comment for why we can't use PySys_SetArgv --- source/blender/python/intern/bpy_interface.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/blender/python') 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); } -- cgit v1.2.3