diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 48a5ddf..c2f5a7c 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -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 diff --git a/Include/internal/pycore_abstract.h b/Include/internal/pycore_abstract.h index 1d4605a..9474f0c 100644 --- a/Include/internal/pycore_abstract.h +++ b/Include/internal/pycore_abstract.h @@ -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); } diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 0d033d2..1a6743d 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -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 */ diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 93bdac5..96abdee 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -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 */ diff --git a/Objects/abstract.c b/Objects/abstract.c index 49057c9..f3951e5 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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)); diff --git a/Objects/boolobject.c b/Objects/boolobject.c index fcb896f..934754b 100644 --- a/Objects/boolobject.c +++ b/Objects/boolobject.c @@ -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 */ diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 2e33695..6201f01 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -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*/ diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 84e6eb6..3cd9b09 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -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*/ diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 6b79fe4..ae9d8dc 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -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 */ diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 53c1ebf..8aa289d 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -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, }; diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 6fba4f8..13176b8 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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*/ diff --git a/Objects/floatobject.c b/Objects/floatobject.c index a93d63a..61e06a5 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -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 */ diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 3891428..efe7191 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -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, }; diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index 81713af..d8351bd 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -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 }; diff --git a/Objects/genobject.c b/Objects/genobject.c index 11fe724..017ec04 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -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 */ diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 4e78723..4f9b33b 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -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 */ diff --git a/Objects/longobject.c b/Objects/longobject.c index 7c4064e..4cf8f82 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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; } diff --git a/Objects/object.c b/Objects/object.c index 321f35e..6b51d37 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -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, }; diff --git a/Objects/odictobject.c b/Objects/odictobject.c index 91a13bd..f341db8 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -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, }; diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index b46fa9c..c893283 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -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, }; diff --git a/Objects/setobject.c b/Objects/setobject.c index 6a078c6..97cc2f3 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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*/ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 267d82b..18fd4ef 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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 }; diff --git a/Objects/typeslots.inc b/Objects/typeslots.inc index 642160f..92f6488 100644 --- a/Objects/typeslots.inc +++ b/Objects/typeslots.inc @@ -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)}, diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c index acfdbbc..65a3fb1 100644 --- a/Objects/typevarobject.c +++ b/Objects/typevarobject.c @@ -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, }; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 5be330b..37b5340 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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*/ diff --git a/Objects/unionobject.c b/Objects/unionobject.c index 3133adf..a815f48 100644 --- a/Objects/unionobject.c +++ b/Objects/unionobject.c @@ -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 }; diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index 59fcf42..5343be1 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -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*/ diff --git a/Python/specialize.c b/Python/specialize.c index bd4386f..d1d636e 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -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; }