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.
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 @@
val = typ;
typ = PyExceptionInstance_Class(typ);
Py_INCREF(typ);
+
+ if (tb == NULL) {
+ /* Returns NULL if there's no traceback */
+ tb = PyException_GetTraceback(val);
+ }
}
}
else {