{LYN-4372} fix for Python exit crash (#1600)
There is a crash when sys.exit() was being called since embedded Python should not have control of the application lifetime. The Py_InspectFlag puts the Python VM into 'inspection mode' which prevents the app shutdown when any sys.exit() is invoked. Notes: * skips 'regset' extra command line in PythonBindingsExample * added methods for handling PythonBindingsExample errors Test: added Application_SystemExit_Blocked and fixed up Application_Run_Fails now is Application_Run_Works
This commit is contained in:
@@ -496,6 +496,7 @@ namespace EditorPythonBindings
|
||||
// ignore system location for sites site-packages
|
||||
Py_IsolatedFlag = 1; // -I - Also sets Py_NoUserSiteDirectory. If removed PyNoUserSiteDirectory should be set.
|
||||
Py_IgnoreEnvironmentFlag = 1; // -E
|
||||
Py_InspectFlag = 1; // unhandled SystemExit will terminate the process unless Py_InspectFlag is set
|
||||
|
||||
const bool initializeSignalHandlers = true;
|
||||
pybind11::initialize_interpreter(initializeSignalHandlers);
|
||||
|
||||
Reference in New Issue
Block a user