summaryrefslogtreecommitdiffstats
path: root/Objects/genobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-18 14:40:50 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-18 14:40:50 (GMT)
commit551ba20e8ea9a4a97cf63f28b47175e084eb63cd (patch)
treea4b28e975a3e3b7bef76a97e201d1f0631b1b3e6 /Objects/genobject.c
parent6bfecd1271b305afcbe3f3f68980f89aa44e1910 (diff)
downloadcpython-551ba20e8ea9a4a97cf63f28b47175e084eb63cd.zip
cpython-551ba20e8ea9a4a97cf63f28b47175e084eb63cd.tar.gz
cpython-551ba20e8ea9a4a97cf63f28b47175e084eb63cd.tar.bz2
Issue #13188: When called without an explicit traceback argument,
generator.throw() now gets the traceback from the passed exception's `__traceback__` attribute. Patch by Petri Lehtinen.
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r--Objects/genobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 01cd44a..49e2ade 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -261,6 +261,11 @@ gen_throw(PyGenObject *gen, PyObject *args)
val = typ;
typ = PyExceptionInstance_Class(typ);
Py_INCREF(typ);
+
+ if (tb == NULL) {
+ /* Returns NULL if there's no traceback */
+ tb = PyException_GetTraceback(val);
+ }
}
}
else {