[3.13] gh-152132: Fix bugs in Py_RunMain() (GH-153461) (GH-153466) (#153468)
[3.15] gh-152132: Fix bugs in Py_RunMain() (GH-153461) (GH-153466)
* Check for signals more often. Previously, a pending exception could
be removed by PyErr_Clear().
* Only call _PyInterpreterState_SetNotRunningMain() if
_PyInterpreterState_SetRunningMain() has been called.
* Convert _PyPathConfig_UpdateGlobal() PyStatus error to an
exception.
(cherry picked from commit
cecafebc2e30ab2aac5f046ed5c9fbc75d6bfb51)
Co-authored-by: Victor Stinner <vstinner@python.org>