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:
Antoine Pitrou 2011-10-18 16:42:55 +02:00
commit cf28eacafe
3 changed files with 35 additions and 0 deletions

View file

@ -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 {