From: Jacob Bower <1978924+jbower-fb@users.noreply.github.com> Date: Fri, 26 Sep 2025 18:52:10 +0000 (-0700) Subject: gh-139276: Remove generator type check in _testcapimodule.c:raise_SIGINT_then_send_No... X-Git-Tag: v3.15.0a1~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=93ac3525b92f5f8918211a241c01324dfa8b1e5e;p=thirdparty%2FPython%2Fcpython.git gh-139276: Remove generator type check in _testcapimodule.c:raise_SIGINT_then_send_None (#139252) * 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. * Also stop using PyGenObject type --- diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 508ef55511e4..4e73be20e1b7 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1583,9 +1583,9 @@ 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!", &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 @@ -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); }