mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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.
This commit is contained in:
commit
cf28eacafe
3 changed files with 35 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue