Revert "PyAPI: point sys.executable to the Python binary"

This reverts commit 04c5471cee.

This causes Blender not to start on some systems.
This commit is contained in:
Campbell Barton
2020-10-28 19:40:48 +11:00
parent 4f24808d08
commit a8ca79cbe6
3 changed files with 35 additions and 22 deletions

View File

@@ -292,13 +292,36 @@ static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self),
return bpy_app_global_flag_set(NULL, value, closure);
}
#define BROKEN_BINARY_PATH_PYTHON_HACK
PyDoc_STRVAR(bpy_app_binary_path_python_doc,
"String, the path to the python executable (read-only). "
"Deprecated! Use ``sys.executable`` instead.");
static PyObject *bpy_app_binary_path_python_get(PyObject *UNUSED(self), void *UNUSED(closure))
"String, the path to the python executable (read-only)");
static PyObject *bpy_app_binary_path_python_get(PyObject *self, void *UNUSED(closure))
{
PyErr_Warn(PyExc_RuntimeWarning, "Use 'sys.executable' instead of 'binary_path_python'!");
return Py_INCREF_RET(PySys_GetObject("executable"));
/* refcount is held in BlenderAppType.tp_dict */
static PyObject *ret = NULL;
if (ret == NULL) {
/* only run once */
char fullpath[1024];
BKE_appdir_program_python_search(
fullpath, sizeof(fullpath), PY_MAJOR_VERSION, PY_MINOR_VERSION);
ret = PyC_UnicodeFromByte(fullpath);
#ifdef BROKEN_BINARY_PATH_PYTHON_HACK
Py_INCREF(ret);
UNUSED_VARS(self);
#else
PyDict_SetItem(
BlenderAppType.tp_dict,
/* XXX BAAAADDDDDD! self is not a PyDescr at all! it's bpy.app!!! */ PyDescr_NAME(self),
ret);
#endif
}
else {
Py_INCREF(ret);
}
return ret;
}
PyDoc_STRVAR(bpy_app_debug_value_doc,