Merge branch 'blender-v2.91-release'

This commit is contained in:
2020-10-29 11:29:13 +11:00
7 changed files with 45 additions and 24 deletions

View File

@@ -306,7 +306,11 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
PyThreadState *py_tstate = NULL;
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
/* Not essential but nice to set our name. */
/* Needed for Python's initialization for portable Python installations.
* We could use #Py_SetPath, but this overrides Python's internal logic
* for calculating it's own module search paths.
*
* `sys.executable` is overwritten after initialization to the Python binary. */
{
const char *program_path = BKE_appdir_program_path();
wchar_t program_path_wchar[FILE_MAX];
@@ -353,6 +357,23 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
Py_DECREF(py_argv);
}
/* Setting the program name is important so the 'multiprocessing' module
* can launch new Python instances. */
{
char program_path[FILE_MAX];
if (BKE_appdir_program_python_search(
program_path, sizeof(program_path), PY_MAJOR_VERSION, PY_MINOR_VERSION)) {
PyObject *py_program_path = PyC_UnicodeFromByte(program_path);
PySys_SetObject("executable", py_program_path);
Py_DECREF(py_program_path);
}
else {
fprintf(stderr,
"Unable to find the python binary, "
"the multiprocessing module may not be functional!\n");
}
}
# ifdef WITH_FLUID
/* Required to prevent assertion error, see:
* https://stackoverflow.com/questions/27844676 */