https://github.com/python/cpython/commit/93ac3525b92f5f8918211a241c01324dfa8b1e5e
commit: 93ac3525b92f5f8918211a241c01324dfa8b1e5e
branch: main
author: Jacob Bower <[email protected]>
committer: mpage <[email protected]>
date: 2025-09-26T11:52:10-07:00
summary:

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

files:
M Modules/_testcapimodule.c

diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 508ef55511e49d..4e73be20e1b709 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);
 }
 
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to