summaryrefslogtreecommitdiffstats
path: root/Modules/_asynciomodule.c
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-12-01 16:36:22 (GMT)
committerYury Selivanov <yury@magic.io>2016-12-01 16:36:22 (GMT)
commitc2c8fe1252dda7dd973a1da440607a1d9a9638f0 (patch)
treec1570df14ae72f89eea0cecb61c6c1dbf77ae10d /Modules/_asynciomodule.c
parentc349374ee6309a9e85d98c2c9c22b9ce0e48bdfc (diff)
downloadcpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.zip
cpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.tar.gz
cpython-c2c8fe1252dda7dd973a1da440607a1d9a9638f0.tar.bz2
Issue #28843: Fix asyncio C Task to handle exceptions __traceback__.
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r--Modules/_asynciomodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index b65fc02..4e8f74a 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1042,6 +1042,8 @@ FutureIter_throw(futureiterobject *self, PyObject *args)
if (PyExceptionClass_Check(type)) {
PyErr_NormalizeException(&type, &val, &tb);
+ /* No need to call PyException_SetTraceback since we'll be calling
+ PyErr_Restore for `type`, `val`, and `tb`. */
} else if (PyExceptionInstance_Check(type)) {
if (val) {
PyErr_SetString(PyExc_TypeError,
@@ -2003,6 +2005,9 @@ task_step_impl(TaskObj *task, PyObject *exc)
if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) {
PyErr_NormalizeException(&et, &ev, &tb);
}
+ if (tb != NULL) {
+ PyException_SetTraceback(ev, tb);
+ }
o = future_set_exception((FutureObj*)task, ev);
if (!o) {
/* An exception in Task.set_exception() */