diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-18 14:42:55 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-18 14:42:55 (GMT) |
commit | cf28eacafe603fac8784d4a0b22b7864aec4a383 (patch) | |
tree | b7b543a8d435b63346424dd7dc951b8fe0430efb /Objects | |
parent | 3de134b1d18ab2e74a4093358fd28333eb101f7a (diff) | |
parent | 551ba20e8ea9a4a97cf63f28b47175e084eb63cd (diff) | |
download | cpython-cf28eacafe603fac8784d4a0b22b7864aec4a383.zip cpython-cf28eacafe603fac8784d4a0b22b7864aec4a383.tar.gz cpython-cf28eacafe603fac8784d4a0b22b7864aec4a383.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')
-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 43d0335..b7765ef 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 { |