bpo-37369: Fixes crash when reporting fatal error (GH-14468)

This commit is contained in:
Steve Dower 2019-06-29 14:28:43 -07:00 committed by GitHub
parent 9048c49322
commit ac14632c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -166,12 +166,12 @@ wmain(int argc, wchar_t **argv)
PyPreConfig_InitPythonConfig(&preconfig); PyPreConfig_InitPythonConfig(&preconfig);
status = Py_PreInitializeFromArgs(&preconfig, argc, argv); status = Py_PreInitializeFromArgs(&preconfig, argc, argv);
if (PyStatus_Exception(status)) { if (PyStatus_Exception(status)) {
goto fail; goto fail_without_config;
} }
status = PyConfig_InitPythonConfig(&config); status = PyConfig_InitPythonConfig(&config);
if (PyStatus_Exception(status)) { if (PyStatus_Exception(status)) {
goto fail; goto fail_without_config;
} }
status = PyConfig_SetArgv(&config, argc, argv); status = PyConfig_SetArgv(&config, argc, argv);
@ -233,6 +233,7 @@ wmain(int argc, wchar_t **argv)
fail: fail:
PyConfig_Clear(&config); PyConfig_Clear(&config);
fail_without_config:
if (PyStatus_IsExit(status)) { if (PyStatus_IsExit(status)) {
return status.exitcode; return status.exitcode;
} }