6a0f98aeef
Non-matching calls to PyErr_Fetch/Restore cause a leak in v3.12, so ensure calls are symmetrical or avoid where possible. Simplify extraction of the exception buffer. - Only overwrite the stderr (the stdio isn't used). - Simplify pyc_exception_buffer_handle_system_exit usage. - Remove goto's. Also simplify calling conventions for PyC_ExceptionBuffer functions. - They must be called when an error has occurred. - Always return a string, never null since a null return value would only happened in rare/unexpected cases which wasn't being checked for by some callers, leading to potential crashes.