From 5292200c9b5a34815690310a07001f63d3bdce6e Mon Sep 17 00:00:00 2001 From: Bot <1978924+jbower-fb@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:47:37 -0700 Subject: [PATCH 1/2] Remove generator type check in raise_SIGINT_then_send_None In the Cinder JIT we use a different type for generators, which breaks the test which uses this function. In general I believe the intent with generators is they have the right structure rather than type, so a failure to find the 'send()' method is arguably more correct if the wrong object is used. --- Modules/_testcapimodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 508ef55511e49d..161fbc284a0357 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1585,7 +1585,7 @@ raise_SIGINT_then_send_None(PyObject *self, PyObject *args) { PyGenObject *gen; - if (!PyArg_ParseTuple(args, "O!", &PyGen_Type, &gen)) + if (!PyArg_ParseTuple(args, "O", &gen)) return NULL; /* This is used in a test to check what happens if a signal arrives just From 61543b3aa69b17f2bfa5dfae295c8fe04007d295 Mon Sep 17 00:00:00 2001 From: Bot <1978924+jbower-fb@users.noreply.github.com> Date: Wed, 24 Sep 2025 09:02:08 -0700 Subject: [PATCH 2/2] Also stop using PyGenObject type --- Modules/_testcapimodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 161fbc284a0357..4e73be20e1b709 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1583,7 +1583,7 @@ getitem_with_error(PyObject *self, PyObject *args) static PyObject * raise_SIGINT_then_send_None(PyObject *self, PyObject *args) { - PyGenObject *gen; + PyObject *gen; if (!PyArg_ParseTuple(args, "O", &gen)) return NULL; @@ -1599,7 +1599,7 @@ raise_SIGINT_then_send_None(PyObject *self, PyObject *args) because we check for signals before every bytecode operation. */ raise(SIGINT); - return PyObject_CallMethod((PyObject *)gen, "send", "O", Py_None); + return PyObject_CallMethod(gen, "send", "O", Py_None); }