coro->cr_origin wasn't initialized if compute_cr_origin() failed in
PyCoro_New(), which would cause a crash during the coroutine's
deallocation.
https://bugs.python.org/issue35269
--- /dev/null
+Fix a possible segfault involving a newly-created coroutine. Patch by
+Zackery Spytz.
((PyCoroObject *)coro)->cr_origin = NULL;
} else {
PyObject *cr_origin = compute_cr_origin(origin_depth);
+ ((PyCoroObject *)coro)->cr_origin = cr_origin;
if (!cr_origin) {
Py_DECREF(coro);
return NULL;
}
- ((PyCoroObject *)coro)->cr_origin = cr_origin;
}
return coro;