]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-139276: Remove generator type check in _testcapimodule.c:raise_SIGINT_then_send_No...
authorJacob Bower <1978924+jbower-fb@users.noreply.github.com>
Fri, 26 Sep 2025 18:52:10 +0000 (11:52 -0700)
committerGitHub <noreply@github.com>
Fri, 26 Sep 2025 18:52:10 +0000 (11:52 -0700)
* 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

Modules/_testcapimodule.c

index 508ef55511e49deaa59e24398eea94209a15590c..4e73be20e1b7097d583f981bfb8895111ac081e0 100644 (file)
@@ -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);
 }