{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:
@@ -28,6 +28,18 @@ namespace PythonBindingsExample
|
||||
void TearDown();
|
||||
bool RunWithParameters(const ApplicationParameters& params);
|
||||
|
||||
inline void GetErrorCount(int& exceptionCount, int& errorCount)
|
||||
{
|
||||
exceptionCount = m_pythonExceptionCount;
|
||||
errorCount = m_pythonErrorCount;
|
||||
}
|
||||
|
||||
inline void ResetErrorCount()
|
||||
{
|
||||
m_pythonExceptionCount = 0;
|
||||
m_pythonErrorCount = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TraceMessageBus
|
||||
|
||||
@@ -60,6 +60,10 @@ PythonBindingsExample.exe --file path/to/file.py --arg one --arg two
|
||||
{
|
||||
m_interactiveMode = true;
|
||||
}
|
||||
else if (switchItem.m_option.starts_with("regset"))
|
||||
{
|
||||
// skip
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning("python_app", false, "Unknown switch %s \n", switchItem.m_option.c_str());
|
||||
|
||||
Reference in New Issue
Block a user