summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c8
-rw-r--r--Objects/codeobject.c30
-rw-r--r--Objects/complexobject.c6
-rw-r--r--Objects/descrobject.c18
-rw-r--r--Objects/exceptions.c62
-rw-r--r--Objects/frameobject.c4
-rw-r--r--Objects/funcobject.c20
-rw-r--r--Objects/genericaliasobject.c8
-rw-r--r--Objects/genobject.c8
-rw-r--r--Objects/methodobject.c4
-rw-r--r--Objects/moduleobject.c4
-rw-r--r--Objects/namespaceobject.c6
-rw-r--r--Objects/rangeobject.c8
-rw-r--r--Objects/sliceobject.c8
-rw-r--r--Objects/structseq.c6
-rw-r--r--Objects/typeobject.c42
-rw-r--r--Objects/typevarobject.c26
-rw-r--r--Objects/unionobject.c4
-rw-r--r--Objects/weakrefobject.c4
19 files changed, 139 insertions, 137 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 548b867..6f4457d 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -5,7 +5,7 @@
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "structmember.h" // PyMemberDef
+
#include "clinic/classobject.c.h"
@@ -150,9 +150,9 @@ static PyMethodDef method_methods[] = {
#define MO_OFF(x) offsetof(PyMethodObject, x)
static PyMemberDef method_memberlist[] = {
- {"__func__", T_OBJECT, MO_OFF(im_func), READONLY,
+ {"__func__", _Py_T_OBJECT, MO_OFF(im_func), Py_READONLY,
"the function (or other callable) implementing a method"},
- {"__self__", T_OBJECT, MO_OFF(im_self), READONLY,
+ {"__self__", _Py_T_OBJECT, MO_OFF(im_self), Py_READONLY,
"the instance to which a method is bound"},
{NULL} /* Sentinel */
};
@@ -372,7 +372,7 @@ PyInstanceMethod_Function(PyObject *im)
#define IMO_OFF(x) offsetof(PyInstanceMethodObject, x)
static PyMemberDef instancemethod_memberlist[] = {
- {"__func__", T_OBJECT, IMO_OFF(func), READONLY,
+ {"__func__", _Py_T_OBJECT, IMO_OFF(func), Py_READONLY,
"the function (or other callable) implementing a method"},
{NULL} /* Sentinel */
};
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 977e5b0..81fa339 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -2,7 +2,7 @@
#include "Python.h"
#include "opcode.h"
-#include "structmember.h" // PyMemberDef
+
#include "pycore_code.h" // _PyCodeConstructor
#include "pycore_frame.h" // FRAME_SPECIALS_SIZE
#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
@@ -1877,20 +1877,20 @@ code_hash(PyCodeObject *co)
#define OFF(x) offsetof(PyCodeObject, x)
static PyMemberDef code_memberlist[] = {
- {"co_argcount", T_INT, OFF(co_argcount), READONLY},
- {"co_posonlyargcount", T_INT, OFF(co_posonlyargcount), READONLY},
- {"co_kwonlyargcount", T_INT, OFF(co_kwonlyargcount), READONLY},
- {"co_stacksize", T_INT, OFF(co_stacksize), READONLY},
- {"co_flags", T_INT, OFF(co_flags), READONLY},
- {"co_nlocals", T_INT, OFF(co_nlocals), READONLY},
- {"co_consts", T_OBJECT, OFF(co_consts), READONLY},
- {"co_names", T_OBJECT, OFF(co_names), READONLY},
- {"co_filename", T_OBJECT, OFF(co_filename), READONLY},
- {"co_name", T_OBJECT, OFF(co_name), READONLY},
- {"co_qualname", T_OBJECT, OFF(co_qualname), READONLY},
- {"co_firstlineno", T_INT, OFF(co_firstlineno), READONLY},
- {"co_linetable", T_OBJECT, OFF(co_linetable), READONLY},
- {"co_exceptiontable", T_OBJECT, OFF(co_exceptiontable), READONLY},
+ {"co_argcount", Py_T_INT, OFF(co_argcount), Py_READONLY},
+ {"co_posonlyargcount", Py_T_INT, OFF(co_posonlyargcount), Py_READONLY},
+ {"co_kwonlyargcount", Py_T_INT, OFF(co_kwonlyargcount), Py_READONLY},
+ {"co_stacksize", Py_T_INT, OFF(co_stacksize), Py_READONLY},
+ {"co_flags", Py_T_INT, OFF(co_flags), Py_READONLY},
+ {"co_nlocals", Py_T_INT, OFF(co_nlocals), Py_READONLY},
+ {"co_consts", _Py_T_OBJECT, OFF(co_consts), Py_READONLY},
+ {"co_names", _Py_T_OBJECT, OFF(co_names), Py_READONLY},
+ {"co_filename", _Py_T_OBJECT, OFF(co_filename), Py_READONLY},
+ {"co_name", _Py_T_OBJECT, OFF(co_name), Py_READONLY},
+ {"co_qualname", _Py_T_OBJECT, OFF(co_qualname), Py_READONLY},
+ {"co_firstlineno", Py_T_INT, OFF(co_firstlineno), Py_READONLY},
+ {"co_linetable", _Py_T_OBJECT, OFF(co_linetable), Py_READONLY},
+ {"co_exceptiontable", _Py_T_OBJECT, OFF(co_exceptiontable), Py_READONLY},
{NULL} /* Sentinel */
};
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 12968a6..0e96f54 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -11,7 +11,7 @@
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_object.h" // _PyObject_Init()
#include "pycore_pymath.h" // _Py_ADJUST_ERANGE2()
-#include "structmember.h" // PyMemberDef
+
/*[clinic input]
@@ -720,9 +720,9 @@ static PyMethodDef complex_methods[] = {
};
static PyMemberDef complex_members[] = {
- {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY,
+ {"real", Py_T_DOUBLE, offsetof(PyComplexObject, cval.real), Py_READONLY,
"the real part of a complex number"},
- {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), READONLY,
+ {"imag", Py_T_DOUBLE, offsetof(PyComplexObject, cval.imag), Py_READONLY,
"the imaginary part of a complex number"},
{0},
};
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 74aa70b..60383dd 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -8,7 +8,7 @@
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_tuple.h" // _PyTuple_ITEMS()
-#include "structmember.h" // PyMemberDef
+
/*[clinic input]
class mappingproxy "mappingproxyobject *" "&PyDictProxy_Type"
@@ -182,7 +182,7 @@ member_get(PyMemberDescrObject *descr, PyObject *obj, PyObject *type)
return NULL;
}
- if (descr->d_member->flags & PY_AUDIT_READ) {
+ if (descr->d_member->flags & Py_AUDIT_READ) {
if (PySys_Audit("object.__getattr__", "Os",
obj ? obj : Py_None, descr->d_member->name) < 0) {
return NULL;
@@ -640,8 +640,8 @@ static PyMethodDef descr_methods[] = {
};
static PyMemberDef descr_members[] = {
- {"__objclass__", T_OBJECT, offsetof(PyDescrObject, d_type), READONLY},
- {"__name__", T_OBJECT, offsetof(PyDescrObject, d_name), READONLY},
+ {"__objclass__", _Py_T_OBJECT, offsetof(PyDescrObject, d_type), Py_READONLY},
+ {"__name__", _Py_T_OBJECT, offsetof(PyDescrObject, d_name), Py_READONLY},
{0}
};
@@ -1355,7 +1355,7 @@ static PyMethodDef wrapper_methods[] = {
};
static PyMemberDef wrapper_members[] = {
- {"__self__", T_OBJECT, offsetof(wrapperobject, self), READONLY},
+ {"__self__", _Py_T_OBJECT, offsetof(wrapperobject, self), Py_READONLY},
{0}
};
@@ -1515,10 +1515,10 @@ static PyObject * property_copy(PyObject *, PyObject *, PyObject *,
PyObject *);
static PyMemberDef property_members[] = {
- {"fget", T_OBJECT, offsetof(propertyobject, prop_get), READONLY},
- {"fset", T_OBJECT, offsetof(propertyobject, prop_set), READONLY},
- {"fdel", T_OBJECT, offsetof(propertyobject, prop_del), READONLY},
- {"__doc__", T_OBJECT, offsetof(propertyobject, prop_doc), 0},
+ {"fget", _Py_T_OBJECT, offsetof(propertyobject, prop_get), Py_READONLY},
+ {"fset", _Py_T_OBJECT, offsetof(propertyobject, prop_set), Py_READONLY},
+ {"fdel", _Py_T_OBJECT, offsetof(propertyobject, prop_del), Py_READONLY},
+ {"__doc__", _Py_T_OBJECT, offsetof(propertyobject, prop_doc), 0},
{0}
};
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 42c5317..62a4423 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -12,7 +12,7 @@
#include "pycore_exceptions.h" // struct _Py_exc_state
#include "pycore_initconfig.h"
#include "pycore_object.h"
-#include "structmember.h" // PyMemberDef
+
#include "osdefs.h" // SEP
@@ -439,7 +439,7 @@ PyExceptionClass_Name(PyObject *ob)
}
static struct PyMemberDef BaseException_members[] = {
- {"__suppress_context__", T_BOOL,
+ {"__suppress_context__", Py_T_BOOL,
offsetof(PyBaseExceptionObject, suppress_context)},
{NULL}
};
@@ -569,7 +569,7 @@ SimpleExtendsException(PyExc_Exception, StopAsyncIteration,
*/
static PyMemberDef StopIteration_members[] = {
- {"value", T_OBJECT, offsetof(PyStopIterationObject, value), 0,
+ {"value", _Py_T_OBJECT, offsetof(PyStopIterationObject, value), 0,
PyDoc_STR("generator return value")},
{NULL} /* Sentinel */
};
@@ -671,7 +671,7 @@ SystemExit_traverse(PySystemExitObject *self, visitproc visit, void *arg)
}
static PyMemberDef SystemExit_members[] = {
- {"code", T_OBJECT, offsetof(PySystemExitObject, code), 0,
+ {"code", _Py_T_OBJECT, offsetof(PySystemExitObject, code), 0,
PyDoc_STR("exception code")},
{NULL} /* Sentinel */
};
@@ -1477,9 +1477,9 @@ PyUnstable_Exc_PrepReraiseStar(PyObject *orig, PyObject *excs)
}
static PyMemberDef BaseExceptionGroup_members[] = {
- {"message", T_OBJECT, offsetof(PyBaseExceptionGroupObject, msg), READONLY,
+ {"message", _Py_T_OBJECT, offsetof(PyBaseExceptionGroupObject, msg), Py_READONLY,
PyDoc_STR("exception message")},
- {"exceptions", T_OBJECT, offsetof(PyBaseExceptionGroupObject, excs), READONLY,
+ {"exceptions", _Py_T_OBJECT, offsetof(PyBaseExceptionGroupObject, excs), Py_READONLY,
PyDoc_STR("nested exceptions")},
{NULL} /* Sentinel */
};
@@ -1654,13 +1654,13 @@ ImportError_reduce(PyImportErrorObject *self, PyObject *Py_UNUSED(ignored))
}
static PyMemberDef ImportError_members[] = {
- {"msg", T_OBJECT, offsetof(PyImportErrorObject, msg), 0,
+ {"msg", _Py_T_OBJECT, offsetof(PyImportErrorObject, msg), 0,
PyDoc_STR("exception message")},
- {"name", T_OBJECT, offsetof(PyImportErrorObject, name), 0,
+ {"name", _Py_T_OBJECT, offsetof(PyImportErrorObject, name), 0,
PyDoc_STR("module name")},
- {"path", T_OBJECT, offsetof(PyImportErrorObject, path), 0,
+ {"path", _Py_T_OBJECT, offsetof(PyImportErrorObject, path), 0,
PyDoc_STR("module path")},
- {"name_from", T_OBJECT, offsetof(PyImportErrorObject, name_from), 0,
+ {"name_from", _Py_T_OBJECT, offsetof(PyImportErrorObject, name_from), 0,
PyDoc_STR("name imported from module")},
{NULL} /* Sentinel */
};
@@ -2103,16 +2103,16 @@ OSError_written_set(PyOSErrorObject *self, PyObject *arg, void *context)
}
static PyMemberDef OSError_members[] = {
- {"errno", T_OBJECT, offsetof(PyOSErrorObject, myerrno), 0,
+ {"errno", _Py_T_OBJECT, offsetof(PyOSErrorObject, myerrno), 0,
PyDoc_STR("POSIX exception code")},
- {"strerror", T_OBJECT, offsetof(PyOSErrorObject, strerror), 0,
+ {"strerror", _Py_T_OBJECT, offsetof(PyOSErrorObject, strerror), 0,
PyDoc_STR("exception strerror")},
- {"filename", T_OBJECT, offsetof(PyOSErrorObject, filename), 0,
+ {"filename", _Py_T_OBJECT, offsetof(PyOSErrorObject, filename), 0,
PyDoc_STR("exception filename")},
- {"filename2", T_OBJECT, offsetof(PyOSErrorObject, filename2), 0,
+ {"filename2", _Py_T_OBJECT, offsetof(PyOSErrorObject, filename2), 0,
PyDoc_STR("second exception filename")},
#ifdef MS_WINDOWS
- {"winerror", T_OBJECT, offsetof(PyOSErrorObject, winerror), 0,
+ {"winerror", _Py_T_OBJECT, offsetof(PyOSErrorObject, winerror), 0,
PyDoc_STR("Win32 exception code")},
#endif
{NULL} /* Sentinel */
@@ -2249,7 +2249,7 @@ NameError_traverse(PyNameErrorObject *self, visitproc visit, void *arg)
}
static PyMemberDef NameError_members[] = {
- {"name", T_OBJECT, offsetof(PyNameErrorObject, name), 0, PyDoc_STR("name")},
+ {"name", _Py_T_OBJECT, offsetof(PyNameErrorObject, name), 0, PyDoc_STR("name")},
{NULL} /* Sentinel */
};
@@ -2368,8 +2368,8 @@ AttributeError_reduce(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored)
}
static PyMemberDef AttributeError_members[] = {
- {"name", T_OBJECT, offsetof(PyAttributeErrorObject, name), 0, PyDoc_STR("attribute name")},
- {"obj", T_OBJECT, offsetof(PyAttributeErrorObject, obj), 0, PyDoc_STR("object")},
+ {"name", _Py_T_OBJECT, offsetof(PyAttributeErrorObject, name), 0, PyDoc_STR("attribute name")},
+ {"obj", _Py_T_OBJECT, offsetof(PyAttributeErrorObject, obj), 0, PyDoc_STR("object")},
{NULL} /* Sentinel */
};
@@ -2541,21 +2541,21 @@ SyntaxError_str(PySyntaxErrorObject *self)
}
static PyMemberDef SyntaxError_members[] = {
- {"msg", T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0,
+ {"msg", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0,
PyDoc_STR("exception msg")},
- {"filename", T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0,
+ {"filename", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0,
PyDoc_STR("exception filename")},
- {"lineno", T_OBJECT, offsetof(PySyntaxErrorObject, lineno), 0,
+ {"lineno", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, lineno), 0,
PyDoc_STR("exception lineno")},
- {"offset", T_OBJECT, offsetof(PySyntaxErrorObject, offset), 0,
+ {"offset", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, offset), 0,
PyDoc_STR("exception offset")},
- {"text", T_OBJECT, offsetof(PySyntaxErrorObject, text), 0,
+ {"text", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, text), 0,
PyDoc_STR("exception text")},
- {"end_lineno", T_OBJECT, offsetof(PySyntaxErrorObject, end_lineno), 0,
+ {"end_lineno", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, end_lineno), 0,
PyDoc_STR("exception end lineno")},
- {"end_offset", T_OBJECT, offsetof(PySyntaxErrorObject, end_offset), 0,
+ {"end_offset", _Py_T_OBJECT, offsetof(PySyntaxErrorObject, end_offset), 0,
PyDoc_STR("exception end offset")},
- {"print_file_and_line", T_OBJECT,
+ {"print_file_and_line", _Py_T_OBJECT,
offsetof(PySyntaxErrorObject, print_file_and_line), 0,
PyDoc_STR("exception print_file_and_line")},
{NULL} /* Sentinel */
@@ -2910,15 +2910,15 @@ UnicodeError_traverse(PyUnicodeErrorObject *self, visitproc visit, void *arg)
}
static PyMemberDef UnicodeError_members[] = {
- {"encoding", T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0,
+ {"encoding", _Py_T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0,
PyDoc_STR("exception encoding")},
- {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0,
+ {"object", _Py_T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0,
PyDoc_STR("exception object")},
- {"start", T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0,
+ {"start", Py_T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0,
PyDoc_STR("exception start")},
- {"end", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0,
+ {"end", Py_T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0,
PyDoc_STR("exception end")},
- {"reason", T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0,
+ {"reason", _Py_T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0,
PyDoc_STR("exception reason")},
{NULL} /* Sentinel */
};
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 1882055..cc9ac4b 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -11,12 +11,12 @@
#include "frameobject.h" // PyFrameObject
#include "pycore_frame.h"
#include "opcode.h" // EXTENDED_ARG
-#include "structmember.h" // PyMemberDef
+
#define OFF(x) offsetof(PyFrameObject, x)
static PyMemberDef frame_memberlist[] = {
- {"f_trace_lines", T_BOOL, OFF(f_trace_lines), 0},
+ {"f_trace_lines", Py_T_BOOL, OFF(f_trace_lines), 0},
{NULL} /* Sentinel */
};
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 0c69bf4..7fffa1c 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -6,7 +6,7 @@
#include "pycore_code.h" // _Py_next_func_version
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_pyerrors.h" // _PyErr_Occurred()
-#include "structmember.h" // PyMemberDef
+
static PyObject* func_repr(PyFunctionObject *op);
@@ -451,11 +451,11 @@ PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
#define OFF(x) offsetof(PyFunctionObject, x)
static PyMemberDef func_memberlist[] = {
- {"__closure__", T_OBJECT, OFF(func_closure), READONLY},
- {"__doc__", T_OBJECT, OFF(func_doc), 0},
- {"__globals__", T_OBJECT, OFF(func_globals), READONLY},
- {"__module__", T_OBJECT, OFF(func_module), 0},
- {"__builtins__", T_OBJECT, OFF(func_builtins), READONLY},
+ {"__closure__", _Py_T_OBJECT, OFF(func_closure), Py_READONLY},
+ {"__doc__", _Py_T_OBJECT, OFF(func_doc), 0},
+ {"__globals__", _Py_T_OBJECT, OFF(func_globals), Py_READONLY},
+ {"__module__", _Py_T_OBJECT, OFF(func_module), 0},
+ {"__builtins__", _Py_T_OBJECT, OFF(func_builtins), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -1063,8 +1063,8 @@ cm_init(PyObject *self, PyObject *args, PyObject *kwds)
}
static PyMemberDef cm_memberlist[] = {
- {"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
- {"__wrapped__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
+ {"__func__", _Py_T_OBJECT, offsetof(classmethod, cm_callable), Py_READONLY},
+ {"__wrapped__", _Py_T_OBJECT, offsetof(classmethod, cm_callable), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -1258,8 +1258,8 @@ sm_call(PyObject *callable, PyObject *args, PyObject *kwargs)
}
static PyMemberDef sm_memberlist[] = {
- {"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
- {"__wrapped__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
+ {"__func__", _Py_T_OBJECT, offsetof(staticmethod, sm_callable), Py_READONLY},
+ {"__wrapped__", _Py_T_OBJECT, offsetof(staticmethod, sm_callable), Py_READONLY},
{NULL} /* Sentinel */
};
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 0c478f3..df88734 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -3,7 +3,7 @@
#include "Python.h"
#include "pycore_object.h"
#include "pycore_unionobject.h" // _Py_union_type_or, _PyGenericAlias_Check
-#include "structmember.h" // PyMemberDef
+
#include <stdbool.h>
@@ -782,9 +782,9 @@ static PyMethodDef ga_methods[] = {
};
static PyMemberDef ga_members[] = {
- {"__origin__", T_OBJECT, offsetof(gaobject, origin), READONLY},
- {"__args__", T_OBJECT, offsetof(gaobject, args), READONLY},
- {"__unpacked__", T_BOOL, offsetof(gaobject, starred), READONLY},
+ {"__origin__", _Py_T_OBJECT, offsetof(gaobject, origin), Py_READONLY},
+ {"__args__", _Py_T_OBJECT, offsetof(gaobject, args), Py_READONLY},
+ {"__unpacked__", Py_T_BOOL, offsetof(gaobject, starred), Py_READONLY},
{0}
};
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 103e8b8..a630f84 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -10,7 +10,7 @@
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_pyerrors.h" // _PyErr_ClearExcState()
#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "structmember.h" // PyMemberDef
+
#include "opcode.h" // SEND
#include "frameobject.h" // _PyInterpreterFrame_GetLine
#include "pystats.h"
@@ -1144,7 +1144,7 @@ static PyGetSetDef coro_getsetlist[] = {
};
static PyMemberDef coro_memberlist[] = {
- {"cr_origin", T_OBJECT, offsetof(PyCoroObject, cr_origin_or_finalizer), READONLY},
+ {"cr_origin", _Py_T_OBJECT, offsetof(PyCoroObject, cr_origin_or_finalizer), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -1558,8 +1558,8 @@ static PyGetSetDef async_gen_getsetlist[] = {
};
static PyMemberDef async_gen_memberlist[] = {
- {"ag_running", T_BOOL, offsetof(PyAsyncGenObject, ag_running_async),
- READONLY},
+ {"ag_running", Py_T_BOOL, offsetof(PyAsyncGenObject, ag_running_async),
+ Py_READONLY},
{NULL} /* Sentinel */
};
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index fe08199..628d227 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -7,7 +7,7 @@
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "structmember.h" // PyMemberDef
+
/* undefine macro trampoline to PyCFunction_NewEx */
#undef PyCFunction_New
@@ -273,7 +273,7 @@ static PyGetSetDef meth_getsets [] = {
#define OFF(x) offsetof(PyCFunctionObject, x)
static PyMemberDef meth_members[] = {
- {"__module__", T_OBJECT, OFF(m_module), 0},
+ {"__module__", _Py_T_OBJECT, OFF(m_module), 0},
{NULL}
};
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index ba20534..7e890d0 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -9,11 +9,11 @@
#include "pycore_object.h" // _PyType_AllocNoTrack
#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "structmember.h" // PyMemberDef
+
static PyMemberDef module_members[] = {
- {"__dict__", T_OBJECT, offsetof(PyModuleObject, md_dict), READONLY},
+ {"__dict__", _Py_T_OBJECT, offsetof(PyModuleObject, md_dict), Py_READONLY},
{0}
};
diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c
index 2cc4ddd..11cf859 100644
--- a/Objects/namespaceobject.c
+++ b/Objects/namespaceobject.c
@@ -2,7 +2,9 @@
#include "Python.h"
#include "pycore_namespace.h" // _PyNamespace_Type
-#include "structmember.h" // PyMemberDef
+
+#include <stddef.h> // offsetof()
+
typedef struct {
@@ -12,7 +14,7 @@ typedef struct {
static PyMemberDef namespace_members[] = {
- {"__dict__", T_OBJECT, offsetof(_PyNamespaceObject, ns_dict), READONLY},
+ {"__dict__", _Py_T_OBJECT, offsetof(_PyNamespaceObject, ns_dict), Py_READONLY},
{NULL}
};
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 6dc41d7..1e3d5ac 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -6,7 +6,7 @@
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_range.h"
#include "pycore_tuple.h" // _PyTuple_ITEMS()
-#include "structmember.h" // PyMemberDef
+
/* Support objects whose length is > PY_SSIZE_T_MAX.
@@ -757,9 +757,9 @@ static PyMethodDef range_methods[] = {
};
static PyMemberDef range_members[] = {
- {"start", T_OBJECT_EX, offsetof(rangeobject, start), READONLY},
- {"stop", T_OBJECT_EX, offsetof(rangeobject, stop), READONLY},
- {"step", T_OBJECT_EX, offsetof(rangeobject, step), READONLY},
+ {"start", Py_T_OBJECT_EX, offsetof(rangeobject, start), Py_READONLY},
+ {"stop", Py_T_OBJECT_EX, offsetof(rangeobject, stop), Py_READONLY},
+ {"step", Py_T_OBJECT_EX, offsetof(rangeobject, step), Py_READONLY},
{0}
};
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 5a33977..dc3aad1 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -17,7 +17,7 @@ this type and there is exactly one in existence.
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_object.h" // _PyObject_GC_TRACK()
-#include "structmember.h" // PyMemberDef
+
static PyObject *
ellipsis_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -377,9 +377,9 @@ slice_repr(PySliceObject *r)
}
static PyMemberDef slice_members[] = {
- {"start", T_OBJECT, offsetof(PySliceObject, start), READONLY},
- {"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY},
- {"step", T_OBJECT, offsetof(PySliceObject, step), READONLY},
+ {"start", _Py_T_OBJECT, offsetof(PySliceObject, start), Py_READONLY},
+ {"stop", _Py_T_OBJECT, offsetof(PySliceObject, stop), Py_READONLY},
+ {"step", _Py_T_OBJECT, offsetof(PySliceObject, step), Py_READONLY},
{0}
};
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 4901113..700f67c 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -10,7 +10,7 @@
#include "Python.h"
#include "pycore_tuple.h" // _PyTuple_FromArray()
#include "pycore_object.h" // _PyObject_GC_TRACK()
-#include "structmember.h" // PyMemberDef
+
#include "pycore_structseq.h" // PyStructSequence_InitType()
#include "pycore_initconfig.h" // _PyStatus_OK()
@@ -465,10 +465,10 @@ initialize_members(PyStructSequence_Desc *desc,
/* The names and docstrings in these MemberDefs are statically */
/* allocated so it is expected that they'll outlive the MemberDef */
members[k].name = desc->fields[i].name;
- members[k].type = T_OBJECT;
+ members[k].type = _Py_T_OBJECT;
members[k].offset = offsetof(PyStructSequence, ob_item)
+ i * sizeof(PyObject*);
- members[k].flags = READONLY;
+ members[k].flags = Py_READONLY;
members[k].doc = desc->fields[i].doc;
k++;
}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 7e5282c..abe33f1 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -18,7 +18,7 @@
#include "pycore_unionobject.h" // _Py_union_type_or
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
#include "opcode.h" // MAKE_CELL
-#include "structmember.h" // PyMemberDef
+
#include <ctype.h>
#include <stddef.h> // ptrdiff_t
@@ -935,16 +935,16 @@ int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
static PyMemberDef type_members[] = {
- {"__basicsize__", T_PYSSIZET, offsetof(PyTypeObject,tp_basicsize),READONLY},
- {"__itemsize__", T_PYSSIZET, offsetof(PyTypeObject, tp_itemsize), READONLY},
- {"__flags__", T_ULONG, offsetof(PyTypeObject, tp_flags), READONLY},
+ {"__basicsize__", Py_T_PYSSIZET, offsetof(PyTypeObject,tp_basicsize),Py_READONLY},
+ {"__itemsize__", Py_T_PYSSIZET, offsetof(PyTypeObject, tp_itemsize), Py_READONLY},
+ {"__flags__", Py_T_ULONG, offsetof(PyTypeObject, tp_flags), Py_READONLY},
/* Note that this value is misleading for static builtin types,
since the memory at this offset will always be NULL. */
- {"__weakrefoffset__", T_PYSSIZET,
- offsetof(PyTypeObject, tp_weaklistoffset), READONLY},
- {"__base__", T_OBJECT, offsetof(PyTypeObject, tp_base), READONLY},
- {"__dictoffset__", T_PYSSIZET,
- offsetof(PyTypeObject, tp_dictoffset), READONLY},
+ {"__weakrefoffset__", Py_T_PYSSIZET,
+ offsetof(PyTypeObject, tp_weaklistoffset), Py_READONLY},
+ {"__base__", _Py_T_OBJECT, offsetof(PyTypeObject, tp_base), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET,
+ offsetof(PyTypeObject, tp_dictoffset), Py_READONLY},
{0}
};
@@ -1775,7 +1775,7 @@ traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg)
n = Py_SIZE(type);
mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
- if (mp->type == T_OBJECT_EX) {
+ if (mp->type == Py_T_OBJECT_EX) {
char *addr = (char *)self + mp->offset;
PyObject *obj = *(PyObject **)addr;
if (obj != NULL) {
@@ -1850,7 +1850,7 @@ clear_slots(PyTypeObject *type, PyObject *self)
n = Py_SIZE(type);
mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
- if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) {
+ if (mp->type == Py_T_OBJECT_EX && !(mp->flags & Py_READONLY)) {
char *addr = (char *)self + mp->offset;
PyObject *obj = *(PyObject **)addr;
if (obj != NULL) {
@@ -3567,7 +3567,7 @@ type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
if (mp->name == NULL) {
return -1;
}
- mp->type = T_OBJECT_EX;
+ mp->type = Py_T_OBJECT_EX;
mp->offset = slotoffset;
/* __dict__ and __weakref__ are already filtered out */
@@ -4116,20 +4116,20 @@ _PyType_FromMetaclass_impl(
nmembers++;
if (strcmp(memb->name, "__weaklistoffset__") == 0) {
// The PyMemberDef must be a Py_ssize_t and readonly
- assert(memb->type == T_PYSSIZET);
- assert(memb->flags == READONLY);
+ assert(memb->type == Py_T_PYSSIZET);
+ assert(memb->flags == Py_READONLY);
weaklistoffset = memb->offset;
}
if (strcmp(memb->name, "__dictoffset__") == 0) {
// The PyMemberDef must be a Py_ssize_t and readonly
- assert(memb->type == T_PYSSIZET);
- assert(memb->flags == READONLY);
+ assert(memb->type == Py_T_PYSSIZET);
+ assert(memb->flags == Py_READONLY);
dictoffset = memb->offset;
}
if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
// The PyMemberDef must be a Py_ssize_t and readonly
- assert(memb->type == T_PYSSIZET);
- assert(memb->flags == READONLY);
+ assert(memb->type == Py_T_PYSSIZET);
+ assert(memb->flags == Py_READONLY);
vectorcalloffset = memb->offset;
}
if (memb->flags & Py_RELATIVE_OFFSET) {
@@ -10178,11 +10178,11 @@ typedef struct {
} superobject;
static PyMemberDef super_members[] = {
- {"__thisclass__", T_OBJECT, offsetof(superobject, type), READONLY,
+ {"__thisclass__", _Py_T_OBJECT, offsetof(superobject, type), Py_READONLY,
"the class invoking super()"},
- {"__self__", T_OBJECT, offsetof(superobject, obj), READONLY,
+ {"__self__", _Py_T_OBJECT, offsetof(superobject, obj), Py_READONLY,
"the instance invoking super(); may be None"},
- {"__self_class__", T_OBJECT, offsetof(superobject, obj_type), READONLY,
+ {"__self_class__", _Py_T_OBJECT, offsetof(superobject, obj_type), Py_READONLY,
"the type of the instance invoking super(); may be None"},
{0}
};
diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c
index 5605662..e09e6a6 100644
--- a/Objects/typevarobject.c
+++ b/Objects/typevarobject.c
@@ -3,7 +3,7 @@
#include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
#include "pycore_typevarobject.h"
#include "pycore_unionobject.h" // _Py_union_type_or
-#include "structmember.h"
+
/*[clinic input]
class typevar "typevarobject *" "&_PyTypeVar_Type"
@@ -244,10 +244,10 @@ typevar_repr(PyObject *self)
}
static PyMemberDef typevar_members[] = {
- {"__name__", T_OBJECT, offsetof(typevarobject, name), READONLY},
- {"__covariant__", T_BOOL, offsetof(typevarobject, covariant), READONLY},
- {"__contravariant__", T_BOOL, offsetof(typevarobject, contravariant), READONLY},
- {"__infer_variance__", T_BOOL, offsetof(typevarobject, infer_variance), READONLY},
+ {"__name__", _Py_T_OBJECT, offsetof(typevarobject, name), Py_READONLY},
+ {"__covariant__", Py_T_BOOL, offsetof(typevarobject, covariant), Py_READONLY},
+ {"__contravariant__", Py_T_BOOL, offsetof(typevarobject, contravariant), Py_READONLY},
+ {"__infer_variance__", Py_T_BOOL, offsetof(typevarobject, infer_variance), Py_READONLY},
{0}
};
@@ -555,7 +555,7 @@ paramspecattr_richcompare(PyObject *a, PyObject *b, int op)
}
static PyMemberDef paramspecattr_members[] = {
- {"__origin__", T_OBJECT, offsetof(paramspecattrobject, __origin__), READONLY},
+ {"__origin__", _Py_T_OBJECT, offsetof(paramspecattrobject, __origin__), Py_READONLY},
{0}
};
@@ -780,11 +780,11 @@ paramspec_repr(PyObject *self)
}
static PyMemberDef paramspec_members[] = {
- {"__name__", T_OBJECT, offsetof(paramspecobject, name), READONLY},
- {"__bound__", T_OBJECT, offsetof(paramspecobject, bound), READONLY},
- {"__covariant__", T_BOOL, offsetof(paramspecobject, covariant), READONLY},
- {"__contravariant__", T_BOOL, offsetof(paramspecobject, contravariant), READONLY},
- {"__infer_variance__", T_BOOL, offsetof(paramspecobject, infer_variance), READONLY},
+ {"__name__", _Py_T_OBJECT, offsetof(paramspecobject, name), Py_READONLY},
+ {"__bound__", _Py_T_OBJECT, offsetof(paramspecobject, bound), Py_READONLY},
+ {"__covariant__", Py_T_BOOL, offsetof(paramspecobject, covariant), Py_READONLY},
+ {"__contravariant__", Py_T_BOOL, offsetof(paramspecobject, contravariant), Py_READONLY},
+ {"__infer_variance__", Py_T_BOOL, offsetof(paramspecobject, infer_variance), Py_READONLY},
{0}
};
@@ -1054,7 +1054,7 @@ typevartuple_repr(PyObject *self)
}
static PyMemberDef typevartuple_members[] = {
- {"__name__", T_OBJECT, offsetof(typevartupleobject, name), READONLY},
+ {"__name__", _Py_T_OBJECT, offsetof(typevartupleobject, name), Py_READONLY},
{0}
};
@@ -1292,7 +1292,7 @@ typealias_repr(PyObject *self)
}
static PyMemberDef typealias_members[] = {
- {"__name__", T_OBJECT, offsetof(typealiasobject, name), READONLY},
+ {"__name__", _Py_T_OBJECT, offsetof(typealiasobject, name), Py_READONLY},
{0}
};
diff --git a/Objects/unionobject.c b/Objects/unionobject.c
index 269f469..347945a 100644
--- a/Objects/unionobject.c
+++ b/Objects/unionobject.c
@@ -3,7 +3,7 @@
#include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
#include "pycore_typevarobject.h" // _PyTypeAlias_Type
#include "pycore_unionobject.h"
-#include "structmember.h"
+
static PyObject *make_union(PyObject *);
@@ -273,7 +273,7 @@ error:
}
static PyMemberDef union_members[] = {
- {"__args__", T_OBJECT, offsetof(unionobject, args), READONLY},
+ {"__args__", _Py_T_OBJECT, offsetof(unionobject, args), Py_READONLY},
{0}
};
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index e956372..1814c6e 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -2,7 +2,7 @@
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_object.h" // _PyObject_GET_WEAKREFS_LISTPTR()
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
-#include "structmember.h" // PyMemberDef
+
#define GET_WEAKREFS_LISTPTR(o) \
@@ -351,7 +351,7 @@ weakref___init__(PyObject *self, PyObject *args, PyObject *kwargs)
static PyMemberDef weakref_members[] = {
- {"__callback__", T_OBJECT, offsetof(PyWeakReference, wr_callback), READONLY},
+ {"__callback__", _Py_T_OBJECT, offsetof(PyWeakReference, wr_callback), Py_READONLY},
{NULL} /* Sentinel */
};