summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-04-11 08:38:37 (GMT)
committerGitHub <noreply@github.com>2023-04-11 08:38:37 (GMT)
commit78b763f63032a7185c0905c319ead9e9b35787b6 (patch)
tree065fe97b6d301d4ad35303f4bd5a347f9ecba9c7 /Python
parent8026cda10ccd3cbc7f7ff84dc6970266512961e4 (diff)
downloadcpython-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.c13
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;
}