@@ -225,9 +225,15 @@ counter_dealloc(_PyCounterExecutorObject *self) {
225225 PyObject_Free (self );
226226}
227227
228- static PyMemberDef counter_members [] = {
229- { "valid" , Py_T_UBYTE , offsetof(_PyCounterExecutorObject , executor .vm_data .valid ), Py_READONLY , "is valid?" },
230- { NULL }
228+ static PyObject *
229+ is_valid (PyObject * self , PyObject * Py_UNUSED (ignored ))
230+ {
231+ return PyBool_FromLong (((_PyExecutorObject * )self )-> vm_data .valid );
232+ }
233+
234+ static PyMethodDef executor_methods [] = {
235+ { "is_valid" , is_valid , METH_NOARGS , NULL },
236+ { NULL , NULL },
231237};
232238
233239static PyTypeObject CounterExecutor_Type = {
@@ -237,7 +243,7 @@ static PyTypeObject CounterExecutor_Type = {
237243 .tp_itemsize = 0 ,
238244 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
239245 .tp_dealloc = (destructor )counter_dealloc ,
240- .tp_members = counter_members ,
246+ .tp_methods = executor_methods ,
241247};
242248
243249static _PyInterpreterFrame *
@@ -280,7 +286,7 @@ counter_get_counter(PyObject *self, PyObject *args)
280286 return PyLong_FromLongLong (((_PyCounterOptimizerObject * )self )-> count );
281287}
282288
283- static PyMethodDef counter_methods [] = {
289+ static PyMethodDef counter_optimizer_methods [] = {
284290 { "get_count" , counter_get_counter , METH_NOARGS , NULL },
285291 { NULL , NULL },
286292};
@@ -291,7 +297,7 @@ static PyTypeObject CounterOptimizer_Type = {
291297 .tp_basicsize = sizeof (_PyCounterOptimizerObject ),
292298 .tp_itemsize = 0 ,
293299 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
294- .tp_methods = counter_methods ,
300+ .tp_methods = counter_optimizer_methods ,
295301 .tp_dealloc = (destructor )PyObject_Del ,
296302};
297303
@@ -369,12 +375,6 @@ PySequenceMethods uop_as_sequence = {
369375 .sq_item = (ssizeargfunc )uop_item ,
370376};
371377
372-
373- static PyMemberDef uop_members [] = {
374- { "valid" , Py_T_UBYTE , offsetof(_PyUOpExecutorObject , base .vm_data .valid ), Py_READONLY , "is valid?" },
375- { NULL }
376- };
377-
378378static PyTypeObject UOpExecutor_Type = {
379379 PyVarObject_HEAD_INIT (& PyType_Type , 0 )
380380 .tp_name = "uop_executor" ,
@@ -383,7 +383,7 @@ static PyTypeObject UOpExecutor_Type = {
383383 .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
384384 .tp_dealloc = (destructor )uop_dealloc ,
385385 .tp_as_sequence = & uop_as_sequence ,
386- .tp_members = uop_members ,
386+ .tp_methods = executor_methods ,
387387};
388388
389389static int
0 commit comments