mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
gh-103176: sys._current_exceptions() returns mapping to exception instances instead of exc_info tuples (#103177)
This commit is contained in:
parent
8026cda10c
commit
78b763f630
5 changed files with 23 additions and 10 deletions
|
@ -1986,14 +1986,13 @@ _PyThread_CurrentExceptions(void)
|
|||
if (id == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
PyObject *exc_info = _PyErr_StackItemToExcInfoTuple(err_info);
|
||||
if (exc_info == NULL) {
|
||||
Py_DECREF(id);
|
||||
goto fail;
|
||||
}
|
||||
int stat = PyDict_SetItem(result, id, exc_info);
|
||||
PyObject *exc = err_info->exc_value;
|
||||
assert(exc == NULL ||
|
||||
exc == Py_None ||
|
||||
PyExceptionInstance_Check(exc));
|
||||
|
||||
int stat = PyDict_SetItem(result, id, exc == NULL ? Py_None : exc);
|
||||
Py_DECREF(id);
|
||||
Py_DECREF(exc_info);
|
||||
if (stat < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue