mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-45711: use exc_value instead of exc_type to determine if exc_info is valid. Add more assertions. (GH-29627)
This commit is contained in:
parent
24c10d2943
commit
c456dfafe9
5 changed files with 93 additions and 36 deletions
|
@ -785,12 +785,7 @@ sys_exc_info_impl(PyObject *module)
|
|||
/*[clinic end generated code: output=3afd0940cf3a4d30 input=b5c5bf077788a3e5]*/
|
||||
{
|
||||
_PyErr_StackItem *err_info = _PyErr_GetTopmostException(_PyThreadState_GET());
|
||||
return Py_BuildValue(
|
||||
"(OOO)",
|
||||
err_info->exc_type != NULL ? err_info->exc_type : Py_None,
|
||||
err_info->exc_value != NULL ? err_info->exc_value : Py_None,
|
||||
err_info->exc_traceback != NULL ?
|
||||
err_info->exc_traceback : Py_None);
|
||||
return _PyErr_StackItemToExcInfoTuple(err_info);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue