@@ -225,9 +225,15 @@ counter_dealloc(_PyCounterExecutorObject *self) {
225
225
PyObject_Free (self );
226
226
}
227
227
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 },
231
237
};
232
238
233
239
static PyTypeObject CounterExecutor_Type = {
@@ -237,7 +243,7 @@ static PyTypeObject CounterExecutor_Type = {
237
243
.tp_itemsize = 0 ,
238
244
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
239
245
.tp_dealloc = (destructor )counter_dealloc ,
240
- .tp_members = counter_members ,
246
+ .tp_methods = executor_methods ,
241
247
};
242
248
243
249
static _PyInterpreterFrame *
@@ -280,7 +286,7 @@ counter_get_counter(PyObject *self, PyObject *args)
280
286
return PyLong_FromLongLong (((_PyCounterOptimizerObject * )self )-> count );
281
287
}
282
288
283
- static PyMethodDef counter_methods [] = {
289
+ static PyMethodDef counter_optimizer_methods [] = {
284
290
{ "get_count" , counter_get_counter , METH_NOARGS , NULL },
285
291
{ NULL , NULL },
286
292
};
@@ -291,7 +297,7 @@ static PyTypeObject CounterOptimizer_Type = {
291
297
.tp_basicsize = sizeof (_PyCounterOptimizerObject ),
292
298
.tp_itemsize = 0 ,
293
299
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
294
- .tp_methods = counter_methods ,
300
+ .tp_methods = counter_optimizer_methods ,
295
301
.tp_dealloc = (destructor )PyObject_Del ,
296
302
};
297
303
@@ -369,12 +375,6 @@ PySequenceMethods uop_as_sequence = {
369
375
.sq_item = (ssizeargfunc )uop_item ,
370
376
};
371
377
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
-
378
378
static PyTypeObject UOpExecutor_Type = {
379
379
PyVarObject_HEAD_INIT (& PyType_Type , 0 )
380
380
.tp_name = "uop_executor" ,
@@ -383,7 +383,7 @@ static PyTypeObject UOpExecutor_Type = {
383
383
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION ,
384
384
.tp_dealloc = (destructor )uop_dealloc ,
385
385
.tp_as_sequence = & uop_as_sequence ,
386
- .tp_members = uop_members ,
386
+ .tp_methods = executor_methods ,
387
387
};
388
388
389
389
static int
0 commit comments