Fix #111033: Crash on startup when Blender path isn't UTF8 compatible

This commit is contained in:
Campbell Barton
2023-08-11 14:59:56 +10:00
parent 8ce2ac0d9a
commit ac43b5ec80
3 changed files with 9 additions and 3 deletions

View File

@@ -40,6 +40,8 @@
#include "RNA_prototypes.h"
#include "bpy_rna.h" /* pyrna_struct_CreatePyObject() */
#include "../generic/py_capi_utils.h" /* #PyC_UnicodeFromBytes */
#ifdef __cplusplus
extern "C" {
#endif
@@ -544,7 +546,7 @@ PyObject *Freestyle_Init()
char modpath[FILE_MAX];
BLI_path_join(modpath, sizeof(modpath), path, "modules");
PyObject *sys_path = PySys_GetObject("path"); /* borrow */
PyObject *py_modpath = PyUnicode_FromString(modpath);
PyObject *py_modpath = PyC_UnicodeFromBytes(modpath);
PyList_Append(sys_path, py_modpath);
Py_DECREF(py_modpath);
#if 0