diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-18 14:40:50 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-18 14:40:50 (GMT) |
commit | 551ba20e8ea9a4a97cf63f28b47175e084eb63cd (patch) | |
tree | a4b28e975a3e3b7bef76a97e201d1f0631b1b3e6 /Objects/genobject.c | |
parent | 6bfecd1271b305afcbe3f3f68980f89aa44e1910 (diff) | |
download | cpython-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.c | 5 |
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 { |