diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-04-11 08:38:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 08:38:37 (GMT) |
commit | 78b763f63032a7185c0905c319ead9e9b35787b6 (patch) | |
tree | 065fe97b6d301d4ad35303f4bd5a347f9ecba9c7 /Python | |
parent | 8026cda10ccd3cbc7f7ff84dc6970266512961e4 (diff) | |
download | cpython-78b763f63032a7185c0905c319ead9e9b35787b6.zip cpython-78b763f63032a7185c0905c319ead9e9b35787b6.tar.gz cpython-78b763f63032a7185c0905c319ead9e9b35787b6.tar.bz2 |
gh-103176: sys._current_exceptions() returns mapping to exception instances instead of exc_info tuples (#103177)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pystate.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index d09c1d5..37cef97 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -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; } |