Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_interface.c
| Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | |||||
| #ifdef WITH_CYCLES | #ifdef WITH_CYCLES | ||||
| {"_cycles", CCL_initPython}, | {"_cycles", CCL_initPython}, | ||||
| #endif | #endif | ||||
| {"gpu", BPyInit_gpu}, | {"gpu", BPyInit_gpu}, | ||||
| {"idprop", BPyInit_idprop}, | {"idprop", BPyInit_idprop}, | ||||
| {NULL, NULL}, | {NULL, NULL}, | ||||
| }; | }; | ||||
| static void py_init_sys_excepthook(bContext *C) | |||||
| { | |||||
| PyObject *sys_mod = PyImport_ImportModule("sys"); | |||||
| if (!sys_mod) { | |||||
| return; | |||||
| } | |||||
| PyObject *excepthook_attr_name = NULL; | |||||
| //PyObject_SetAttr(sys_mod, excepthook_attr_name, NULL); | |||||
| } | |||||
| #ifndef WITH_PYTHON_MODULE | #ifndef WITH_PYTHON_MODULE | ||||
| /** | /** | ||||
| * Convenience function for #BPY_python_start. | * Convenience function for #BPY_python_start. | ||||
| * | * | ||||
| * These should happen so rarely that having comprehensive errors isn't needed. | * These should happen so rarely that having comprehensive errors isn't needed. | ||||
| * For example if `sys.argv` fails to allocate memory. | * For example if `sys.argv` fails to allocate memory. | ||||
| * | * | ||||
| * Show an error just to avoid silent failure in the unlikely event something goes wrong, | * Show an error just to avoid silent failure in the unlikely event something goes wrong, | ||||
| ▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | # endif | ||||
| status = Py_InitializeFromConfig(&config); | status = Py_InitializeFromConfig(&config); | ||||
| pystatus_exit_on_error(status); | pystatus_exit_on_error(status); | ||||
| if (!has_python_executable) { | if (!has_python_executable) { | ||||
| PySys_SetObject("executable", Py_None); | PySys_SetObject("executable", Py_None); | ||||
| } | } | ||||
| } | } | ||||
| py_init_sys_excepthook(C); | |||||
| # ifdef WITH_FLUID | # ifdef WITH_FLUID | ||||
| /* Required to prevent assertion error, see: | /* Required to prevent assertion error, see: | ||||
| * https://stackoverflow.com/questions/27844676 */ | * https://stackoverflow.com/questions/27844676 */ | ||||
| Py_DECREF(PyImport_ImportModule("threading")); | Py_DECREF(PyImport_ImportModule("threading")); | ||||
| # endif | # endif | ||||
| #else | #else | ||||
| (void)argc; | (void)argc; | ||||
| ▲ Show 20 Lines • Show All 496 Lines • Show Last 20 Lines | |||||