mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
GH-111339: Change valid
property of executors to is_valid()
method (GH-111350)
This commit is contained in:
parent
78e6d72e38
commit
5c9d4497ab
2 changed files with 19 additions and 19 deletions
|
@ -225,9 +225,15 @@ counter_dealloc(_PyCounterExecutorObject *self) {
|
|||
PyObject_Free(self);
|
||||
}
|
||||
|
||||
static PyMemberDef counter_members[] = {
|
||||
{ "valid", Py_T_UBYTE, offsetof(_PyCounterExecutorObject, executor.vm_data.valid), Py_READONLY, "is valid?" },
|
||||
{ NULL }
|
||||
static PyObject *
|
||||
is_valid(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyBool_FromLong(((_PyExecutorObject *)self)->vm_data.valid);
|
||||
}
|
||||
|
||||
static PyMethodDef executor_methods[] = {
|
||||
{ "is_valid", is_valid, METH_NOARGS, NULL },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
static PyTypeObject CounterExecutor_Type = {
|
||||
|
@ -237,7 +243,7 @@ static PyTypeObject CounterExecutor_Type = {
|
|||
.tp_itemsize = 0,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
||||
.tp_dealloc = (destructor)counter_dealloc,
|
||||
.tp_members = counter_members,
|
||||
.tp_methods = executor_methods,
|
||||
};
|
||||
|
||||
static _PyInterpreterFrame *
|
||||
|
@ -280,7 +286,7 @@ counter_get_counter(PyObject *self, PyObject *args)
|
|||
return PyLong_FromLongLong(((_PyCounterOptimizerObject *)self)->count);
|
||||
}
|
||||
|
||||
static PyMethodDef counter_methods[] = {
|
||||
static PyMethodDef counter_optimizer_methods[] = {
|
||||
{ "get_count", counter_get_counter, METH_NOARGS, NULL },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
@ -291,7 +297,7 @@ static PyTypeObject CounterOptimizer_Type = {
|
|||
.tp_basicsize = sizeof(_PyCounterOptimizerObject),
|
||||
.tp_itemsize = 0,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
||||
.tp_methods = counter_methods,
|
||||
.tp_methods = counter_optimizer_methods,
|
||||
.tp_dealloc = (destructor)PyObject_Del,
|
||||
};
|
||||
|
||||
|
@ -369,12 +375,6 @@ PySequenceMethods uop_as_sequence = {
|
|||
.sq_item = (ssizeargfunc)uop_item,
|
||||
};
|
||||
|
||||
|
||||
static PyMemberDef uop_members[] = {
|
||||
{ "valid", Py_T_UBYTE, offsetof(_PyUOpExecutorObject, base.vm_data.valid), Py_READONLY, "is valid?" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static PyTypeObject UOpExecutor_Type = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
.tp_name = "uop_executor",
|
||||
|
@ -383,7 +383,7 @@ static PyTypeObject UOpExecutor_Type = {
|
|||
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
|
||||
.tp_dealloc = (destructor)uop_dealloc,
|
||||
.tp_as_sequence = &uop_as_sequence,
|
||||
.tp_members = uop_members,
|
||||
.tp_methods = executor_methods,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue