mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-36356: pymain_exit_error() only call pymain_free() for exit (GH-12968)
Add _Py_INIT_HAS_EXITCODE() macro.
This commit is contained in:
parent
00db7c73af
commit
4cb525a1f0
3 changed files with 10 additions and 3 deletions
|
@ -570,7 +570,12 @@ exit_sigint(void)
|
|||
static void _Py_NO_RETURN
|
||||
pymain_exit_error(_PyInitError err)
|
||||
{
|
||||
pymain_free();
|
||||
if (_Py_INIT_HAS_EXITCODE(err)) {
|
||||
/* If it's an error rather than a regular exit, leave Python runtime
|
||||
alive: _Py_ExitInitError() uses the current exception and use
|
||||
sys.stdout in this case. */
|
||||
pymain_free();
|
||||
}
|
||||
_Py_ExitInitError(err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue