Fix final Py_ patterns - uintptr, arithmetic shift, inc files

- Fixed Py_uintptr_t → Ty_uintptr_t
- Fixed Py_ARITHMETIC_RIGHT_SHIFT → Ty_ARITHMETIC_RIGHT_SHIFT
- Fixed PyTypeObject, PyNumberMethods, PyAsyncMethods in .inc files

Build is nearing completion.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-29 18:38:56 +00:00
parent 210fb1519d
commit 0f2e4eb3fd
28 changed files with 140 additions and 140 deletions

View File

@@ -103,7 +103,7 @@ typedef struct {
binaryfunc nb_matrix_multiply;
binaryfunc nb_inplace_matrix_multiply;
} PyNumberMethods;
} TyNumberMethods;
typedef struct {
lenfunc sq_length;
@@ -132,7 +132,7 @@ typedef struct {
unaryfunc am_aiter;
unaryfunc am_anext;
sendfunc am_send;
} PyAsyncMethods;
} TyAsyncMethods;
typedef struct {
getbufferproc bf_getbuffer;
@@ -156,13 +156,13 @@ struct _typeobject {
Ty_ssize_t tp_vectorcall_offset;
getattrfunc tp_getattr;
setattrfunc tp_setattr;
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
TyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
or tp_reserved (Python 3) */
reprfunc tp_repr;
/* Method suites for standard classes */
PyNumberMethods *tp_as_number;
TyNumberMethods *tp_as_number;
PySequenceMethods *tp_as_sequence;
PyMappingMethods *tp_as_mapping;
@@ -267,8 +267,8 @@ typedef struct _heaptypeobject {
/* Note: there's a dependency on the order of these members
in slotptr() in typeobject.c . */
TyTypeObject ht_type;
PyAsyncMethods as_async;
PyNumberMethods as_number;
TyAsyncMethods as_async;
TyNumberMethods as_number;
PyMappingMethods as_mapping;
PySequenceMethods as_sequence; /* as_sequence comes after as_mapping,
so that the mapping wins when both

View File

@@ -12,7 +12,7 @@ extern "C" {
static inline int
_PyIndex_Check(TyObject *obj)
{
PyNumberMethods *tp_as_number = Ty_TYPE(obj)->tp_as_number;
TyNumberMethods *tp_as_number = Ty_TYPE(obj)->tp_as_number;
return (tp_as_number != NULL && tp_as_number->nb_index != NULL);
}

View File

@@ -3035,7 +3035,7 @@ TyDoc_STR("Difference between two datetime values.\n\n"
"All arguments are optional and default to 0.\n"
"Arguments may be integers or floats, and may be positive or negative.");
static PyNumberMethods delta_as_number = {
static TyNumberMethods delta_as_number = {
delta_add, /* nb_add */
delta_subtract, /* nb_subtract */
delta_multiply, /* nb_multiply */
@@ -3958,7 +3958,7 @@ static TyMethodDef date_methods[] = {
static const char date_doc[] =
TyDoc_STR("date(year, month, day) --> date object");
static PyNumberMethods date_as_number = {
static TyNumberMethods date_as_number = {
date_add, /* nb_add */
date_subtract, /* nb_subtract */
0, /* nb_multiply */
@@ -7083,7 +7083,7 @@ TyDoc_STR("datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzi
The year, month and day arguments are required. tzinfo may be None, or an\n\
instance of a tzinfo subclass. The remaining arguments may be ints.\n");
static PyNumberMethods datetime_as_number = {
static TyNumberMethods datetime_as_number = {
datetime_add, /* nb_add */
datetime_subtract, /* nb_subtract */
0, /* nb_multiply */

View File

@@ -2666,7 +2666,7 @@ matmulType_dealloc(TyObject *self)
Ty_TYPE(self)->tp_free(self);
}
static PyNumberMethods matmulType_as_number = {
static TyNumberMethods matmulType_as_number = {
0, /* nb_add */
0, /* nb_subtract */
0, /* nb_multiply */
@@ -2757,7 +2757,7 @@ ipowType_ipow(TyObject *self, TyObject *other, TyObject *mod)
return TyTuple_Pack(2, other, mod);
}
static PyNumberMethods ipowType_as_number = {
static TyNumberMethods ipowType_as_number = {
.nb_inplace_power = ipowType_ipow
};
@@ -2812,7 +2812,7 @@ awaitObject_await(TyObject *op)
return Ty_NewRef(ao->ao_iterator);
}
static PyAsyncMethods awaitType_as_async = {
static TyAsyncMethods awaitType_as_async = {
awaitObject_await, /* am_await */
0, /* am_aiter */
0, /* am_anext */

View File

@@ -904,13 +904,13 @@ PyNumber_Check(TyObject *o)
{
if (o == NULL)
return 0;
PyNumberMethods *nb = Ty_TYPE(o)->tp_as_number;
TyNumberMethods *nb = Ty_TYPE(o)->tp_as_number;
return nb && (nb->nb_index || nb->nb_int || nb->nb_float || TyComplex_Check(o));
}
/* Binary operators */
#define NB_SLOT(x) offsetof(PyNumberMethods, x)
#define NB_SLOT(x) offsetof(TyNumberMethods, x)
#define NB_BINOP(nb_methods, slot) \
(*(binaryfunc*)(& ((char*)nb_methods)[slot]))
#define NB_TERNOP(nb_methods, slot) \
@@ -1024,8 +1024,8 @@ ternary_op(TyObject *v,
const char *op_name
)
{
PyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
PyNumberMethods *mw = Ty_TYPE(w)->tp_as_number;
TyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
TyNumberMethods *mw = Ty_TYPE(w)->tp_as_number;
ternaryfunc slotv;
if (mv != NULL) {
@@ -1072,7 +1072,7 @@ ternary_op(TyObject *v,
Ty_DECREF(x); /* can't do it */
}
PyNumberMethods *mz = Ty_TYPE(z)->tp_as_number;
TyNumberMethods *mz = Ty_TYPE(z)->tp_as_number;
if (mz != NULL) {
ternaryfunc slotz = NB_TERNOP(mz, op_slot);
if (slotz == slotv || slotz == slotw) {
@@ -1221,7 +1221,7 @@ binary_iop1(TyObject *v, TyObject *w, const int iop_slot, const int op_slot
#endif
)
{
PyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
TyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
if (mv != NULL) {
binaryfunc slot = NB_BINOP(mv, iop_slot);
if (slot) {
@@ -1262,7 +1262,7 @@ static TyObject *
ternary_iop(TyObject *v, TyObject *w, TyObject *z, const int iop_slot, const int op_slot,
const char *op_name)
{
PyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
TyNumberMethods *mv = Ty_TYPE(v)->tp_as_number;
if (mv != NULL) {
ternaryfunc slot = NB_TERNOP(mv, iop_slot);
if (slot) {
@@ -1368,7 +1368,7 @@ _PyNumber_InPlacePowerNoMod(TyObject *lhs, TyObject *rhs)
return null_error(); \
} \
\
PyNumberMethods *m = Ty_TYPE(o)->tp_as_number; \
TyNumberMethods *m = Ty_TYPE(o)->tp_as_number; \
if (m && m->op) { \
TyObject *res = (*m->op)(o); \
assert(_Ty_CheckSlotResult(o, #meth_name, res != NULL)); \
@@ -1509,7 +1509,7 @@ TyObject *
PyNumber_Long(TyObject *o)
{
TyObject *result;
PyNumberMethods *m;
TyNumberMethods *m;
Ty_buffer view;
if (o == NULL) {
@@ -1599,7 +1599,7 @@ PyNumber_Float(TyObject *o)
return Ty_NewRef(o);
}
PyNumberMethods *m = Ty_TYPE(o)->tp_as_number;
TyNumberMethods *m = Ty_TYPE(o)->tp_as_number;
if (m && m->nb_float) { /* This should include subclasses of float */
TyObject *res = m->nb_float(o);
assert(_Ty_CheckSlotResult(o, "__float__", res != NULL));

View File

@@ -119,7 +119,7 @@ The class bool is a subclass of the class int, and cannot be subclassed.");
/* Arithmetic methods -- only so we can override &, |, ^. */
static PyNumberMethods bool_as_number = {
static TyNumberMethods bool_as_number = {
0, /* nb_add */
0, /* nb_subtract */
0, /* nb_multiply */

View File

@@ -2775,7 +2775,7 @@ bytearray_mod(TyObject *v, TyObject *w)
return ret;
}
static PyNumberMethods bytearray_as_number = {
static TyNumberMethods bytearray_as_number = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/

View File

@@ -2728,7 +2728,7 @@ bytes_mod(TyObject *self, TyObject *arg)
arg, 0);
}
static PyNumberMethods bytes_as_number = {
static TyNumberMethods bytes_as_number = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/

View File

@@ -1094,7 +1094,7 @@ static TyObject *
actual_complex_new(TyTypeObject *type, TyObject *args, TyObject *kwargs)
{
TyObject *res = NULL;
PyNumberMethods *nbr;
TyNumberMethods *nbr;
if (TyTuple_GET_SIZE(args) > 1 || (kwargs != NULL && TyDict_GET_SIZE(kwargs))) {
return complex_new(type, args, kwargs);
@@ -1170,7 +1170,7 @@ complex_new_impl(TyTypeObject *type, TyObject *r, TyObject *i)
/*[clinic end generated code: output=b6c7dd577b537dc1 input=ff4268dc540958a4]*/
{
TyObject *tmp;
PyNumberMethods *nbr, *nbi = NULL;
TyNumberMethods *nbr, *nbi = NULL;
Ty_complex cr, ci;
int own_r = 0;
int cr_is_complex = 0;
@@ -1342,7 +1342,7 @@ static TyMemberDef complex_members[] = {
{0},
};
static PyNumberMethods complex_as_number = {
static TyNumberMethods complex_as_number = {
complex_add, /* nb_add */
complex_sub, /* nb_subtract */
complex_mul, /* nb_multiply */

View File

@@ -1080,7 +1080,7 @@ mappingproxy_ior(TyObject *self, TyObject *Py_UNUSED(other))
"'|=' is not supported by %s; use '|' instead", Ty_TYPE(self)->tp_name);
}
static PyNumberMethods mappingproxy_as_number = {
static TyNumberMethods mappingproxy_as_number = {
.nb_or = mappingproxy_or,
.nb_inplace_or = mappingproxy_ior,
};

View File

@@ -4837,7 +4837,7 @@ static PySequenceMethods dict_as_sequence = {
0, /* sq_inplace_repeat */
};
static PyNumberMethods dict_as_number = {
static TyNumberMethods dict_as_number = {
.nb_or = dict_or,
.nb_inplace_or = dict_ior,
};
@@ -6375,7 +6375,7 @@ dictviews_xor(TyObject* self, TyObject *other)
return result;
}
static PyNumberMethods dictviews_as_number = {
static TyNumberMethods dictviews_as_number = {
0, /*nb_add*/
dictviews_sub, /*nb_subtract*/
0, /*nb_multiply*/

View File

@@ -252,7 +252,7 @@ float_dealloc(TyObject *op)
double
TyFloat_AsDouble(TyObject *op)
{
PyNumberMethods *nb;
TyNumberMethods *nb;
TyObject *res;
double val;
@@ -1512,7 +1512,7 @@ float_as_integer_ratio_impl(TyObject *self)
TyObject *numerator = NULL;
TyObject *denominator = NULL;
TyObject *result_pair = NULL;
PyNumberMethods *long_methods = TyLong_Type.tp_as_number;
TyNumberMethods *long_methods = TyLong_Type.tp_as_number;
CONVERT_TO_DOUBLE(self, self_double);
@@ -1818,7 +1818,7 @@ static TyGetSetDef float_getset[] = {
};
static PyNumberMethods float_as_number = {
static TyNumberMethods float_as_number = {
float_add, /* nb_add */
float_sub, /* nb_subtract */
float_mul, /* nb_multiply */

View File

@@ -878,7 +878,7 @@ framelocalsproxy_reversed(TyObject *self, TyObject *Py_UNUSED(ignored))
return result;
}
static PyNumberMethods framelocalsproxy_as_number = {
static TyNumberMethods framelocalsproxy_as_number = {
.nb_or = framelocalsproxy_or,
.nb_inplace_or = framelocalsproxy_inplace_or,
};

View File

@@ -880,7 +880,7 @@ ga_new(TyTypeObject *type, TyObject *args, TyObject *kwds)
return (TyObject *)self;
}
static PyNumberMethods ga_as_number = {
static TyNumberMethods ga_as_number = {
.nb_or = _Ty_union_type_or, // Add __or__ function
};

View File

@@ -848,7 +848,7 @@ static TyMethodDef gen_methods[] = {
{NULL, NULL} /* Sentinel */
};
static PyAsyncMethods gen_as_async = {
static TyAsyncMethods gen_as_async = {
0, /* am_await */
0, /* am_aiter */
0, /* am_anext */
@@ -1208,7 +1208,7 @@ static TyMethodDef coro_methods[] = {
{NULL, NULL} /* Sentinel */
};
static PyAsyncMethods coro_as_async = {
static TyAsyncMethods coro_as_async = {
coro_await, /* am_await */
0, /* am_aiter */
0, /* am_anext */
@@ -1641,7 +1641,7 @@ static TyMethodDef async_gen_methods[] = {
};
static PyAsyncMethods async_gen_as_async = {
static TyAsyncMethods async_gen_as_async = {
0, /* am_await */
PyObject_SelfIter, /* am_aiter */
async_gen_anext, /* am_anext */
@@ -1905,7 +1905,7 @@ static TyMethodDef async_gen_asend_methods[] = {
};
static PyAsyncMethods async_gen_asend_as_async = {
static TyAsyncMethods async_gen_asend_as_async = {
PyObject_SelfIter, /* am_await */
0, /* am_aiter */
0, /* am_anext */
@@ -2348,7 +2348,7 @@ static TyMethodDef async_gen_athrow_methods[] = {
};
static PyAsyncMethods async_gen_athrow_as_async = {
static TyAsyncMethods async_gen_athrow_as_async = {
PyObject_SelfIter, /* am_await */
0, /* am_aiter */
0, /* am_anext */

View File

@@ -487,7 +487,7 @@ static TyMethodDef anextawaitable_methods[] = {
};
static PyAsyncMethods anextawaitable_as_async = {
static TyAsyncMethods anextawaitable_as_async = {
PyObject_SelfIter, /* am_await */
0, /* am_aiter */
0, /* am_anext */

View File

@@ -3333,7 +3333,7 @@ x_divrem(PyLongObject *v1, PyLongObject *w1, PyLongObject **prem)
z = (sdigit)vk[i] + zhi -
(stwodigits)q * (stwodigits)w0[i];
vk[i] = (digit)z & TyLong_MASK;
zhi = (sdigit)Py_ARITHMETIC_RIGHT_SHIFT(stwodigits,
zhi = (sdigit)Ty_ARITHMETIC_RIGHT_SHIFT(stwodigits,
z, TyLong_SHIFT);
}
@@ -6502,7 +6502,7 @@ Base 0 means to interpret the base from the string as an integer literal.\n\
>>> int('0b100', base=0)\n\
4");
static PyNumberMethods long_as_number = {
static TyNumberMethods long_as_number = {
long_add_method, /*nb_add*/
long_sub_method, /*nb_subtract*/
long_mul_method, /*nb_multiply*/
@@ -6803,7 +6803,7 @@ TyLong_Export(TyObject *obj, PyLongExport *export_long)
export_long->ndigits = 1;
}
export_long->digits = self->long_value.ob_digit;
export_long->_reserved = (Py_uintptr_t)Ty_NewRef(obj);
export_long->_reserved = (Ty_uintptr_t)Ty_NewRef(obj);
}
return 0;
}

View File

@@ -2096,7 +2096,7 @@ static Ty_hash_t none_hash(TyObject *v)
return 0xFCA86420;
}
static PyNumberMethods none_as_number = {
static TyNumberMethods none_as_number = {
0, /* nb_add */
0, /* nb_subtract */
0, /* nb_multiply */
@@ -2229,7 +2229,7 @@ notimplemented_bool(TyObject *v)
return -1;
}
static PyNumberMethods notimplemented_as_number = {
static TyNumberMethods notimplemented_as_number = {
.nb_bool = notimplemented_bool,
};

View File

@@ -922,7 +922,7 @@ odict_inplace_or(TyObject *self, TyObject *other)
/* tp_as_number */
static PyNumberMethods odict_as_number = {
static TyNumberMethods odict_as_number = {
.nb_or = odict_or,
.nb_inplace_or = odict_inplace_or,
};

View File

@@ -746,7 +746,7 @@ range_bool(TyObject *op)
return PyObject_IsTrue(self->length);
}
static PyNumberMethods range_as_number = {
static TyNumberMethods range_as_number = {
.nb_bool = range_bool,
};

View File

@@ -2506,7 +2506,7 @@ static TyMethodDef set_methods[] = {
{NULL, NULL} /* sentinel */
};
static PyNumberMethods set_as_number = {
static TyNumberMethods set_as_number = {
0, /*nb_add*/
set_sub, /*nb_subtract*/
0, /*nb_multiply*/
@@ -2610,7 +2610,7 @@ static TyMethodDef frozenset_methods[] = {
{NULL, NULL} /* sentinel */
};
static PyNumberMethods frozenset_as_number = {
static TyNumberMethods frozenset_as_number = {
0, /*nb_add*/
set_sub, /*nb_subtract*/
0, /*nb_multiply*/

View File

@@ -6613,7 +6613,7 @@ type_is_gc(TyObject *tp)
}
static PyNumberMethods type_as_number = {
static TyNumberMethods type_as_number = {
.nb_or = _Ty_union_type_or, // Add __or__ function
};

164
Objects/typeslots.inc generated
View File

@@ -1,84 +1,84 @@
/* Generated by typeslots.py */
{offsetof(PyBufferProcs, bf_getbuffer), offsetof(PyTypeObject, tp_as_buffer)},
{offsetof(PyBufferProcs, bf_releasebuffer), offsetof(PyTypeObject, tp_as_buffer)},
{offsetof(PyMappingMethods, mp_ass_subscript), offsetof(PyTypeObject, tp_as_mapping)},
{offsetof(PyMappingMethods, mp_length), offsetof(PyTypeObject, tp_as_mapping)},
{offsetof(PyMappingMethods, mp_subscript), offsetof(PyTypeObject, tp_as_mapping)},
{offsetof(PyNumberMethods, nb_absolute), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_add), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_and), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_bool), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_divmod), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_float), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_floor_divide), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_index), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_add), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_and), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_floor_divide), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_lshift), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_multiply), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_or), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_power), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_remainder), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_rshift), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_subtract), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_true_divide), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_xor), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_int), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_invert), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_lshift), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_multiply), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_negative), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_or), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_positive), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_power), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_remainder), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_rshift), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_subtract), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_true_divide), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_xor), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PySequenceMethods, sq_ass_item), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_concat), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_contains), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_inplace_concat), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_inplace_repeat), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_item), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_length), offsetof(PyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_repeat), offsetof(PyTypeObject, tp_as_sequence)},
{-1, offsetof(PyTypeObject, tp_alloc)},
{-1, offsetof(PyTypeObject, tp_base)},
{-1, offsetof(PyTypeObject, tp_bases)},
{-1, offsetof(PyTypeObject, tp_call)},
{-1, offsetof(PyTypeObject, tp_clear)},
{-1, offsetof(PyTypeObject, tp_dealloc)},
{-1, offsetof(PyTypeObject, tp_del)},
{-1, offsetof(PyTypeObject, tp_descr_get)},
{-1, offsetof(PyTypeObject, tp_descr_set)},
{-1, offsetof(PyTypeObject, tp_doc)},
{-1, offsetof(PyTypeObject, tp_getattr)},
{-1, offsetof(PyTypeObject, tp_getattro)},
{-1, offsetof(PyTypeObject, tp_hash)},
{-1, offsetof(PyTypeObject, tp_init)},
{-1, offsetof(PyTypeObject, tp_is_gc)},
{-1, offsetof(PyTypeObject, tp_iter)},
{-1, offsetof(PyTypeObject, tp_iternext)},
{-1, offsetof(PyTypeObject, tp_methods)},
{-1, offsetof(PyTypeObject, tp_new)},
{-1, offsetof(PyTypeObject, tp_repr)},
{-1, offsetof(PyTypeObject, tp_richcompare)},
{-1, offsetof(PyTypeObject, tp_setattr)},
{-1, offsetof(PyTypeObject, tp_setattro)},
{-1, offsetof(PyTypeObject, tp_str)},
{-1, offsetof(PyTypeObject, tp_traverse)},
{-1, offsetof(PyTypeObject, tp_members)},
{-1, offsetof(PyTypeObject, tp_getset)},
{-1, offsetof(PyTypeObject, tp_free)},
{offsetof(PyNumberMethods, nb_matrix_multiply), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyNumberMethods, nb_inplace_matrix_multiply), offsetof(PyTypeObject, tp_as_number)},
{offsetof(PyAsyncMethods, am_await), offsetof(PyTypeObject, tp_as_async)},
{offsetof(PyAsyncMethods, am_aiter), offsetof(PyTypeObject, tp_as_async)},
{offsetof(PyAsyncMethods, am_anext), offsetof(PyTypeObject, tp_as_async)},
{-1, offsetof(PyTypeObject, tp_finalize)},
{offsetof(PyAsyncMethods, am_send), offsetof(PyTypeObject, tp_as_async)},
{-1, offsetof(PyTypeObject, tp_vectorcall)},
{offsetof(PyBufferProcs, bf_getbuffer), offsetof(TyTypeObject, tp_as_buffer)},
{offsetof(PyBufferProcs, bf_releasebuffer), offsetof(TyTypeObject, tp_as_buffer)},
{offsetof(PyMappingMethods, mp_ass_subscript), offsetof(TyTypeObject, tp_as_mapping)},
{offsetof(PyMappingMethods, mp_length), offsetof(TyTypeObject, tp_as_mapping)},
{offsetof(PyMappingMethods, mp_subscript), offsetof(TyTypeObject, tp_as_mapping)},
{offsetof(TyNumberMethods, nb_absolute), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_add), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_and), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_bool), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_divmod), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_float), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_floor_divide), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_index), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_add), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_and), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_floor_divide), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_lshift), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_multiply), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_or), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_power), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_remainder), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_rshift), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_subtract), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_true_divide), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_xor), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_int), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_invert), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_lshift), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_multiply), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_negative), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_or), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_positive), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_power), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_remainder), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_rshift), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_subtract), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_true_divide), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_xor), offsetof(TyTypeObject, tp_as_number)},
{offsetof(PySequenceMethods, sq_ass_item), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_concat), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_contains), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_inplace_concat), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_inplace_repeat), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_item), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_length), offsetof(TyTypeObject, tp_as_sequence)},
{offsetof(PySequenceMethods, sq_repeat), offsetof(TyTypeObject, tp_as_sequence)},
{-1, offsetof(TyTypeObject, tp_alloc)},
{-1, offsetof(TyTypeObject, tp_base)},
{-1, offsetof(TyTypeObject, tp_bases)},
{-1, offsetof(TyTypeObject, tp_call)},
{-1, offsetof(TyTypeObject, tp_clear)},
{-1, offsetof(TyTypeObject, tp_dealloc)},
{-1, offsetof(TyTypeObject, tp_del)},
{-1, offsetof(TyTypeObject, tp_descr_get)},
{-1, offsetof(TyTypeObject, tp_descr_set)},
{-1, offsetof(TyTypeObject, tp_doc)},
{-1, offsetof(TyTypeObject, tp_getattr)},
{-1, offsetof(TyTypeObject, tp_getattro)},
{-1, offsetof(TyTypeObject, tp_hash)},
{-1, offsetof(TyTypeObject, tp_init)},
{-1, offsetof(TyTypeObject, tp_is_gc)},
{-1, offsetof(TyTypeObject, tp_iter)},
{-1, offsetof(TyTypeObject, tp_iternext)},
{-1, offsetof(TyTypeObject, tp_methods)},
{-1, offsetof(TyTypeObject, tp_new)},
{-1, offsetof(TyTypeObject, tp_repr)},
{-1, offsetof(TyTypeObject, tp_richcompare)},
{-1, offsetof(TyTypeObject, tp_setattr)},
{-1, offsetof(TyTypeObject, tp_setattro)},
{-1, offsetof(TyTypeObject, tp_str)},
{-1, offsetof(TyTypeObject, tp_traverse)},
{-1, offsetof(TyTypeObject, tp_members)},
{-1, offsetof(TyTypeObject, tp_getset)},
{-1, offsetof(TyTypeObject, tp_free)},
{offsetof(TyNumberMethods, nb_matrix_multiply), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyNumberMethods, nb_inplace_matrix_multiply), offsetof(TyTypeObject, tp_as_number)},
{offsetof(TyAsyncMethods, am_await), offsetof(TyTypeObject, tp_as_async)},
{offsetof(TyAsyncMethods, am_aiter), offsetof(TyTypeObject, tp_as_async)},
{offsetof(TyAsyncMethods, am_anext), offsetof(TyTypeObject, tp_as_async)},
{-1, offsetof(TyTypeObject, tp_finalize)},
{offsetof(TyAsyncMethods, am_send), offsetof(TyTypeObject, tp_as_async)},
{-1, offsetof(TyTypeObject, tp_vectorcall)},
{-1, offsetof(PyHeapTypeObject, ht_token)},

View File

@@ -2143,7 +2143,7 @@ __type_params__ attribute.\n\
See PEP 695 for more information.\n\
");
static PyNumberMethods typealias_as_number = {
static TyNumberMethods typealias_as_number = {
.nb_or = _Ty_union_type_or,
};

View File

@@ -14529,7 +14529,7 @@ unicode_mod(TyObject *v, TyObject *w)
return TyUnicode_Format(v, w);
}
static PyNumberMethods unicode_as_number = {
static TyNumberMethods unicode_as_number = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/

View File

@@ -393,7 +393,7 @@ static TyGetSetDef union_properties[] = {
{0}
};
static PyNumberMethods union_as_number = {
static TyNumberMethods union_as_number = {
.nb_or = _Ty_union_type_or, // Add __or__ function
};

View File

@@ -791,7 +791,7 @@ static TyMethodDef proxy_methods[] = {
};
static PyNumberMethods proxy_as_number = {
static TyNumberMethods proxy_as_number = {
proxy_add, /*nb_add*/
proxy_sub, /*nb_subtract*/
proxy_mul, /*nb_multiply*/

View File

@@ -3014,7 +3014,7 @@ to_bool_fail_kind(TyObject *value)
static int
check_type_always_true(TyTypeObject *ty)
{
PyNumberMethods *nb = ty->tp_as_number;
TyNumberMethods *nb = ty->tp_as_number;
if (nb && nb->nb_bool) {
return SPEC_FAIL_TO_BOOL_NUMBER;
}