aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-25 15:28:30 +0200
committerGitHub <noreply@github.com>2023-07-25 15:28:30 +0200
commit1a3faba9f15e0c03c6cc0d225d377b8910b5379f (patch)
tree0aebe4139933835899fd5f618c023bceb9de0389 /Modules
parented082383272c2c238e364e9cc83229234aee23cc (diff)
downloadcpython-1a3faba9f15e0c03c6cc0d225d377b8910b5379f.tar.gz
cpython-1a3faba9f15e0c03c6cc0d225d377b8910b5379f.zip
gh-106869: Use new PyMemberDef constant names (#106871)
* Remove '#include "structmember.h"'. * If needed, add <stddef.h> to get offsetof() function. * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Replace: * T_SHORT => Py_T_SHORT * T_INT => Py_T_INT * T_LONG => Py_T_LONG * T_FLOAT => Py_T_FLOAT * T_DOUBLE => Py_T_DOUBLE * T_STRING => Py_T_STRING * T_OBJECT => _Py_T_OBJECT * T_CHAR => Py_T_CHAR * T_BYTE => Py_T_BYTE * T_UBYTE => Py_T_UBYTE * T_USHORT => Py_T_USHORT * T_UINT => Py_T_UINT * T_ULONG => Py_T_ULONG * T_STRING_INPLACE => Py_T_STRING_INPLACE * T_BOOL => Py_T_BOOL * T_OBJECT_EX => Py_T_OBJECT_EX * T_LONGLONG => Py_T_LONGLONG * T_ULONGLONG => Py_T_ULONGLONG * T_PYSSIZET => Py_T_PYSSIZET * T_NONE => _Py_T_NONE * READONLY => Py_READONLY * PY_AUDIT_READ => Py_AUDIT_READ * READ_RESTRICTED => Py_AUDIT_READ * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_asynciomodule.c2
-rw-r--r--Modules/_bz2module.c14
-rw-r--r--Modules/_collectionsmodule.c8
-rw-r--r--Modules/_csv.c15
-rw-r--r--Modules/_ctypes/_ctypes.c14
-rw-r--r--Modules/_ctypes/callproc.c6
-rw-r--r--Modules/_datetimemodule.c8
-rw-r--r--Modules/_elementtree.c9
-rw-r--r--Modules/_functoolsmodule.c30
-rw-r--r--Modules/_io/bufferedio.c30
-rw-r--r--Modules/_io/bytesio.c4
-rw-r--r--Modules/_io/fileio.c10
-rw-r--r--Modules/_io/iobase.c4
-rw-r--r--Modules/_io/stringio.c4
-rw-r--r--Modules/_io/textio.c16
-rw-r--r--Modules/_io/winconsoleio.c10
-rw-r--r--Modules/_json.c30
-rw-r--r--Modules/_lzmamodule.c10
-rw-r--r--Modules/_multiprocessing/semaphore.c8
-rw-r--r--Modules/_operator.c6
-rw-r--r--Modules/_pickle.c8
-rw-r--r--Modules/_queuemodule.c4
-rw-r--r--Modules/_sqlite/blob.c2
-rw-r--r--Modules/_sqlite/connection.c26
-rw-r--r--Modules/_sqlite/cursor.c14
-rw-r--r--Modules/_sre/sre.c20
-rw-r--r--Modules/_struct.c5
-rw-r--r--Modules/_testcapi/buffer.c4
-rw-r--r--Modules/_testcapi/heaptype.c25
-rw-r--r--Modules/_testcapi/vectorcall.c4
-rw-r--r--Modules/_testcapi/vectorcall_limited.c4
-rw-r--r--Modules/_testcapimodule.c9
-rw-r--r--Modules/_threadmodule.c10
-rw-r--r--Modules/_winapi.c8
-rw-r--r--Modules/_zoneinfo.c10
-rw-r--r--Modules/arraymodule.c4
-rw-r--r--Modules/cjkcodecs/multibytecodec.c12
-rw-r--r--Modules/itertoolsmodule.c4
-rw-r--r--Modules/mmapmodule.c4
-rw-r--r--Modules/overlapped.c12
-rw-r--r--Modules/posixmodule.c6
-rw-r--r--Modules/pyexpat.c7
-rw-r--r--Modules/selectmodule.c35
-rw-r--r--Modules/sha2module.c2
-rw-r--r--Modules/socketmodule.c8
-rw-r--r--Modules/unicodedata.c4
-rw-r--r--Modules/xxsubtype.c5
-rw-r--r--Modules/zlibmodule.c20
48 files changed, 261 insertions, 253 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index ef9f7f8902e..f5a589b00c4 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -8,7 +8,7 @@
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_runtime_init.h" // _Py_ID()
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof()
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index eeefe603499..0a84f25ca4c 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -1,10 +1,10 @@
/* _bz2 - Low-level Python interface to libbzip2. */
#include "Python.h"
-#include "structmember.h" // PyMemberDef
#include <bzlib.h>
#include <stdio.h>
+#include <stddef.h> // offsetof()
// Blocks output buffer wrappers
#include "pycore_blocks_output_buffer.h"
@@ -112,7 +112,7 @@ typedef struct {
typedef struct {
PyObject_HEAD
bz_stream bzs;
- char eof; /* T_BOOL expects a char */
+ char eof; /* Py_T_BOOL expects a char */
PyObject *unused_data;
char needs_input;
char *input_buffer;
@@ -714,11 +714,11 @@ PyDoc_STRVAR(BZ2Decompressor_needs_input_doc,
"True if more input is needed before more decompressed data can be produced.");
static PyMemberDef BZ2Decompressor_members[] = {
- {"eof", T_BOOL, offsetof(BZ2Decompressor, eof),
- READONLY, BZ2Decompressor_eof__doc__},
- {"unused_data", T_OBJECT_EX, offsetof(BZ2Decompressor, unused_data),
- READONLY, BZ2Decompressor_unused_data__doc__},
- {"needs_input", T_BOOL, offsetof(BZ2Decompressor, needs_input), READONLY,
+ {"eof", Py_T_BOOL, offsetof(BZ2Decompressor, eof),
+ Py_READONLY, BZ2Decompressor_eof__doc__},
+ {"unused_data", Py_T_OBJECT_EX, offsetof(BZ2Decompressor, unused_data),
+ Py_READONLY, BZ2Decompressor_unused_data__doc__},
+ {"needs_input", Py_T_BOOL, offsetof(BZ2Decompressor, needs_input), Py_READONLY,
BZ2Decompressor_needs_input_doc},
{NULL}
};
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 9a81531bdff..f2915f83b9d 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -3,7 +3,7 @@
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_typeobject.h" // _PyType_GetModuleState()
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h>
typedef struct {
@@ -1630,7 +1630,7 @@ static PyMethodDef deque_methods[] = {
};
static PyMemberDef deque_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(dequeobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(dequeobject, weakreflist), Py_READONLY},
{NULL},
};
@@ -2054,7 +2054,7 @@ static PyMethodDef defdict_methods[] = {
};
static PyMemberDef defdict_members[] = {
- {"default_factory", T_OBJECT,
+ {"default_factory", _Py_T_OBJECT,
offsetof(defdictobject, default_factory), 0,
PyDoc_STR("Factory for default value called by __missing__().")},
{NULL}
@@ -2466,7 +2466,7 @@ tuplegetter_repr(_tuplegetterobject *self)
static PyMemberDef tuplegetter_members[] = {
- {"__doc__", T_OBJECT, offsetof(_tuplegetterobject, doc), 0},
+ {"__doc__", _Py_T_OBJECT, offsetof(_tuplegetterobject, doc), 0},
{0}
};
diff --git a/Modules/_csv.c b/Modules/_csv.c
index c36d9805a12..24a57e36252 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -11,7 +11,8 @@ module instead.
#define MODULE_VERSION "1.0"
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
+#include <stddef.h> // offsetof()
#include <stdbool.h>
/*[clinic input]
@@ -336,9 +337,9 @@ dialect_check_quoting(int quoting)
#define D_OFF(x) offsetof(DialectObj, x)
static struct PyMemberDef Dialect_memberlist[] = {
- { "skipinitialspace", T_BOOL, D_OFF(skipinitialspace), READONLY },
- { "doublequote", T_BOOL, D_OFF(doublequote), READONLY },
- { "strict", T_BOOL, D_OFF(strict), READONLY },
+ { "skipinitialspace", Py_T_BOOL, D_OFF(skipinitialspace), Py_READONLY },
+ { "doublequote", Py_T_BOOL, D_OFF(doublequote), Py_READONLY },
+ { "strict", Py_T_BOOL, D_OFF(strict), Py_READONLY },
{ NULL }
};
@@ -970,8 +971,8 @@ static struct PyMethodDef Reader_methods[] = {
#define R_OFF(x) offsetof(ReaderObj, x)
static struct PyMemberDef Reader_memberlist[] = {
- { "dialect", T_OBJECT, R_OFF(dialect), READONLY },
- { "line_num", T_ULONG, R_OFF(line_num), READONLY },
+ { "dialect", _Py_T_OBJECT, R_OFF(dialect), Py_READONLY },
+ { "line_num", Py_T_ULONG, R_OFF(line_num), Py_READONLY },
{ NULL }
};
@@ -1364,7 +1365,7 @@ static struct PyMethodDef Writer_methods[] = {
#define W_OFF(x) offsetof(WriterObj, x)
static struct PyMemberDef Writer_memberlist[] = {
- { "dialect", T_OBJECT, W_OFF(dialect), READONLY },
+ { "dialect", _Py_T_OBJECT, W_OFF(dialect), Py_READONLY },
{ NULL }
};
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 200fd36748c..c20d6ae55a0 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -110,7 +110,7 @@ bytes(cdata)
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
-#include "structmember.h" // PyMemberDef
+
#include <ffi.h>
#ifdef MS_WIN32
@@ -2759,14 +2759,14 @@ PyCData_dealloc(PyObject *self)
}
static PyMemberDef PyCData_members[] = {
- { "_b_base_", T_OBJECT,
- offsetof(CDataObject, b_base), READONLY,
+ { "_b_base_", _Py_T_OBJECT,
+ offsetof(CDataObject, b_base), Py_READONLY,
"the base object" },
- { "_b_needsfree_", T_INT,
- offsetof(CDataObject, b_needsfree), READONLY,
+ { "_b_needsfree_", Py_T_INT,
+ offsetof(CDataObject, b_needsfree), Py_READONLY,
"whether the object owns the memory or not" },
- { "_objects", T_OBJECT,
- offsetof(CDataObject, b_objects), READONLY,
+ { "_objects", _Py_T_OBJECT,
+ offsetof(CDataObject, b_objects), Py_READONLY,
"internal objects tree (NEVER CHANGE THIS OBJECT!)"},
{ NULL },
};
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index b3831ae7119..69cf8a98af6 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -59,7 +59,7 @@
#endif
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
#include <stdbool.h>
@@ -581,8 +581,8 @@ PyCArg_repr(PyCArgObject *self)
}
static PyMemberDef PyCArgType_members[] = {
- { "_obj", T_OBJECT,
- offsetof(PyCArgObject, obj), READONLY,
+ { "_obj", _Py_T_OBJECT,
+ offsetof(PyCArgObject, obj), Py_READONLY,
"the wrapped object" },
{ NULL },
};
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index e0e34b78d5d..9002a1de7fb 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -15,7 +15,7 @@
#include "pycore_long.h" // _PyLong_GetOne()
#include "pycore_object.h" // _PyObject_Init()
#include "datetime.h"
-#include "structmember.h" // PyMemberDef
+
#include <time.h>
@@ -2727,13 +2727,13 @@ delta_reduce(PyDateTime_Delta* self, PyObject *Py_UNUSED(ignored))
static PyMemberDef delta_members[] = {
- {"days", T_INT, OFFSET(days), READONLY,
+ {"days", Py_T_INT, OFFSET(days), Py_READONLY,
PyDoc_STR("Number of days.")},
- {"seconds", T_INT, OFFSET(seconds), READONLY,
+ {"seconds", Py_T_INT, OFFSET(seconds), Py_READONLY,
PyDoc_STR("Number of seconds (>= 0 and less than 1 day).")},
- {"microseconds", T_INT, OFFSET(microseconds), READONLY,
+ {"microseconds", Py_T_INT, OFFSET(microseconds), Py_READONLY,
PyDoc_STR("Number of microseconds (>= 0 and less than 1 second).")},
{NULL}
};
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 30327e0b6fc..8cb57e693d8 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -18,7 +18,8 @@
#include "Python.h"
#include "pycore_import.h" // _PyImport_GetModuleAttrString()
#include "pycore_pyhash.h" // _Py_HashSecret
-#include "structmember.h" // PyMemberDef
+
+#include <stddef.h> // offsetof()
#include "expat.h"
#include "pyexpat.h"
@@ -4134,8 +4135,8 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
}
static PyMemberDef xmlparser_members[] = {
- {"entity", T_OBJECT, offsetof(XMLParserObject, entity), READONLY, NULL},
- {"target", T_OBJECT, offsetof(XMLParserObject, target), READONLY, NULL},
+ {"entity", _Py_T_OBJECT, offsetof(XMLParserObject, entity), Py_READONLY, NULL},
+ {"target", _Py_T_OBJECT, offsetof(XMLParserObject, target), Py_READONLY, NULL},
{NULL}
};
@@ -4191,7 +4192,7 @@ static PyMethodDef element_methods[] = {
};
static struct PyMemberDef element_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(ElementObject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(ElementObject, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index c987485e66a..389ff4391de 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -6,7 +6,7 @@
#include "pycore_object.h" // _PyObject_GC_TRACK
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_tuple.h" // _PyTuple_ITEMS()
-#include "structmember.h" // PyMemberDef
+
#include "clinic/_functoolsmodule.c.h"
/*[clinic input]
@@ -340,18 +340,18 @@ PyDoc_STRVAR(partial_doc,
#define OFF(x) offsetof(partialobject, x)
static PyMemberDef partial_memberlist[] = {
- {"func", T_OBJECT, OFF(fn), READONLY,
+ {"func", _Py_T_OBJECT, OFF(fn), Py_READONLY,
"function object to use in future partial calls"},
- {"args", T_OBJECT, OFF(args), READONLY,
+ {"args", _Py_T_OBJECT, OFF(args), Py_READONLY,
"tuple of arguments to future partial calls"},
- {"keywords", T_OBJECT, OFF(kw), READONLY,
+ {"keywords", _Py_T_OBJECT, OFF(kw), Py_READONLY,
"dictionary of keyword arguments to future partial calls"},
- {"__weaklistoffset__", T_PYSSIZET,
- offsetof(partialobject, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET,
- offsetof(partialobject, dict), READONLY},
- {"__vectorcalloffset__", T_PYSSIZET,
- offsetof(partialobject, vectorcall), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET,
+ offsetof(partialobject, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET,
+ offsetof(partialobject, dict), Py_READONLY},
+ {"__vectorcalloffset__", Py_T_PYSSIZET,
+ offsetof(partialobject, vectorcall), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -540,7 +540,7 @@ keyobject_traverse(keyobject *ko, visitproc visit, void *arg)
}
static PyMemberDef keyobject_members[] = {
- {"obj", T_OBJECT,
+ {"obj", _Py_T_OBJECT,
offsetof(keyobject, object), 0,
PyDoc_STR("Value wrapped by a key function.")},
{NULL}
@@ -1394,10 +1394,10 @@ static PyGetSetDef lru_cache_getsetlist[] = {
};
static PyMemberDef lru_cache_memberlist[] = {
- {"__dictoffset__", T_PYSSIZET,
- offsetof(lru_cache_object, dict), READONLY},
- {"__weaklistoffset__", T_PYSSIZET,
- offsetof(lru_cache_object, weakreflist), READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET,
+ offsetof(lru_cache_object, dict), Py_READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET,
+ offsetof(lru_cache_object, weakreflist), Py_READONLY},
{NULL} /* Sentinel */
};
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index efc8cb93d88..0983a7bd151 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -13,7 +13,7 @@
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_pyerrors.h" // _Py_FatalErrorFormat()
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
-#include "structmember.h" // PyMemberDef
+
#include "_iomodule.h"
/*[clinic input]
@@ -2478,10 +2478,10 @@ static PyMethodDef bufferedreader_methods[] = {
};
static PyMemberDef bufferedreader_members[] = {
- {"raw", T_OBJECT, offsetof(buffered, raw), READONLY},
- {"_finalizing", T_BOOL, offsetof(buffered, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(buffered, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(buffered, dict), READONLY},
+ {"raw", _Py_T_OBJECT, offsetof(buffered, raw), Py_READONLY},
+ {"_finalizing", Py_T_BOOL, offsetof(buffered, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(buffered, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(buffered, dict), Py_READONLY},
{NULL}
};
@@ -2538,10 +2538,10 @@ static PyMethodDef bufferedwriter_methods[] = {
};
static PyMemberDef bufferedwriter_members[] = {
- {"raw", T_OBJECT, offsetof(buffered, raw), READONLY},
- {"_finalizing", T_BOOL, offsetof(buffered, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(buffered, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(buffered, dict), READONLY},
+ {"raw", _Py_T_OBJECT, offsetof(buffered, raw), Py_READONLY},
+ {"_finalizing", Py_T_BOOL, offsetof(buffered, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(buffered, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(buffered, dict), Py_READONLY},
{NULL}
};
@@ -2594,8 +2594,8 @@ static PyMethodDef bufferedrwpair_methods[] = {
};
static PyMemberDef bufferedrwpair_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(rwpair, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(rwpair, dict), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(rwpair, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(rwpair, dict), Py_READONLY},
{NULL}
};
@@ -2656,10 +2656,10 @@ static PyMethodDef bufferedrandom_methods[] = {
};
static PyMemberDef bufferedrandom_members[] = {
- {"raw", T_OBJECT, offsetof(buffered, raw), READONLY},
- {"_finalizing", T_BOOL, offsetof(buffered, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(buffered, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(buffered, dict), READONLY},
+ {"raw", _Py_T_OBJECT, offsetof(buffered, raw), Py_READONLY},
+ {"_finalizing", Py_T_BOOL, offsetof(buffered, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(buffered, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(buffered, dict), Py_READONLY},
{NULL}
};
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index 80773058693..3ab503c9e39 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -1028,8 +1028,8 @@ static struct PyMethodDef bytesio_methods[] = {
};
static PyMemberDef bytesio_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(bytesio, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(bytesio, dict), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(bytesio, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(bytesio, dict), Py_READONLY},
{NULL}
};
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 39709fd2931..7fe37eee787 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -3,7 +3,7 @@
#include "Python.h"
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
-#include "structmember.h" // PyMemberDef
+
#include <stdbool.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -1199,10 +1199,10 @@ static PyGetSetDef fileio_getsetlist[] = {
};
static PyMemberDef fileio_members[] = {
- {"_blksize", T_UINT, offsetof(fileio, blksize), 0},
- {"_finalizing", T_BOOL, offsetof(fileio, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(fileio, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(fileio, dict), READONLY},
+ {"_blksize", Py_T_UINT, offsetof(fileio, blksize), 0},
+ {"_finalizing", Py_T_BOOL, offsetof(fileio, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(fileio, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(fileio, dict), Py_READONLY},
{NULL}
};
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index e2e8ef46adf..5fd19895311 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -863,8 +863,8 @@ static PyGetSetDef iobase_getset[] = {
};
static struct PyMemberDef iobase_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(iobase, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(iobase, dict), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(iobase, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(iobase, dict), Py_READONLY},
{NULL},
};
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index 1960002d405..1856b07108b 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -1002,8 +1002,8 @@ static PyGetSetDef stringio_getset[] = {
};
static struct PyMemberDef stringio_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(stringio, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(stringio, dict), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(stringio, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(stringio, dict), Py_READONLY},
{NULL},
};
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index a5cf9fc397f..24d846e6634 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -14,7 +14,7 @@
#include "pycore_fileutils.h" // _Py_GetLocaleEncoding()
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
-#include "structmember.h" // PyMemberDef
+
#include "_iomodule.h"
/*[clinic input]
@@ -3230,13 +3230,13 @@ static PyMethodDef textiowrapper_methods[] = {
};
static PyMemberDef textiowrapper_members[] = {
- {"encoding", T_OBJECT, offsetof(textio, encoding), READONLY},
- {"buffer", T_OBJECT, offsetof(textio, buffer), READONLY},
- {"line_buffering", T_BOOL, offsetof(textio, line_buffering), READONLY},
- {"write_through", T_BOOL, offsetof(textio, write_through), READONLY},
- {"_finalizing", T_BOOL, offsetof(textio, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(textio, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(textio, dict), READONLY},
+ {"encoding", _Py_T_OBJECT, offsetof(textio, encoding), Py_READONLY},
+ {"buffer", _Py_T_OBJECT, offsetof(textio, buffer), Py_READONLY},
+ {"line_buffering", Py_T_BOOL, offsetof(textio, line_buffering), Py_READONLY},
+ {"write_through", Py_T_BOOL, offsetof(textio, write_through), Py_READONLY},
+ {"_finalizing", Py_T_BOOL, offsetof(textio, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(textio, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(textio, dict), Py_READONLY},
{NULL}
};
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 452b12c138f..a1ed7eb61e4 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -12,7 +12,7 @@
#ifdef HAVE_WINDOWS_CONSOLE_IO
-#include "structmember.h" // PyMemberDef
+
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@ -1141,10 +1141,10 @@ static PyGetSetDef winconsoleio_getsetlist[] = {
};
static PyMemberDef winconsoleio_members[] = {
- {"_blksize", T_UINT, offsetof(winconsoleio, blksize), 0},
- {"_finalizing", T_BOOL, offsetof(winconsoleio, finalizing), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(winconsoleio, weakreflist), READONLY},
- {"__dictoffset__", T_PYSSIZET, offsetof(winconsoleio, dict), READONLY},
+ {"_blksize", Py_T_UINT, offsetof(winconsoleio, blksize), 0},
+ {"_finalizing", Py_T_BOOL, offsetof(winconsoleio, finalizing), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(winconsoleio, weakreflist), Py_READONLY},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(winconsoleio, dict), Py_READONLY},
{NULL}
};
diff --git a/Modules/_json.c b/Modules/_json.c
index 2d0e30d7093..4fcaa07d9cf 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -11,7 +11,7 @@
#include "Python.h"
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_runtime.h" // _PyRuntime
-#include "structmember.h" // PyMemberDef
+
#include "pycore_global_objects.h" // _Py_ID()
#include <stdbool.h> // bool
@@ -28,12 +28,12 @@ typedef struct _PyScannerObject {
} PyScannerObject;
static PyMemberDef scanner_members[] = {
- {"strict", T_BOOL, offsetof(PyScannerObject, strict), READONLY, "strict"},
- {"object_hook", T_OBJECT, offsetof(PyScannerObject, object_hook), READONLY, "object_hook"},
- {"object_pairs_hook", T_OBJECT, offsetof(PyScannerObject, object_pairs_hook), READONLY},
- {"parse_float", T_OBJECT, offsetof(PyScannerObject, parse_float), READONLY, "parse_float"},
- {"parse_int", T_OBJECT, offsetof(PyScannerObject, parse_int), READONLY, "parse_int"},
- {"parse_constant", T_OBJECT, offsetof(PyScannerObject, parse_constant), READONLY, "parse_constant"},
+ {"strict", Py_T_BOOL, offsetof(PyScannerObject, strict), Py_READONLY, "strict"},
+ {"object_hook", _Py_T_OBJECT, offsetof(PyScannerObject, object_hook), Py_READONLY, "object_hook"},
+ {"object_pairs_hook", _Py_T_OBJECT, offsetof(PyScannerObject, object_pairs_hook), Py_READONLY},
+ {"parse_float", _Py_T_OBJECT, offsetof(PyScannerObject, parse_float), Py_READONLY, "parse_float"},
+ {"parse_int", _Py_T_OBJECT, offsetof(PyScannerObject, parse_int), Py_READONLY, "parse_int"},
+ {"parse_constant", _Py_T_OBJECT, offsetof(PyScannerObject, parse_constant), Py_READONLY, "parse_constant"},
{NULL}
};
@@ -52,14 +52,14 @@ typedef struct _PyEncoderObject {
} PyEncoderObject;
static PyMemberDef encoder_members[] = {
- {"markers", T_OBJECT, offsetof(PyEncoderObject, markers), READONLY, "markers"},
- {"default", T_OBJECT, offsetof(PyEncoderObject, defaultfn), READONLY, "default"},
- {"encoder", T_OBJECT, offsetof(PyEncoderObject, encoder), READONLY, "encoder"},
- {"indent", T_OBJECT, offsetof(PyEncoderObject, indent), READONLY, "indent"},
- {"key_separator", T_OBJECT, offsetof(PyEncoderObject, key_separator), READONLY, "key_separator"},
- {"item_separator", T_OBJECT, offsetof(PyEncoderObject, item_separator), READONLY, "item_separator"},
- {"sort_keys", T_BOOL, offsetof(PyEncoderObject, sort_keys), READONLY, "sort_keys"},
- {"skipkeys", T_BOOL, offsetof(PyEncoderObject, skipkeys), READONLY, "skipkeys"},
+ {"markers", _Py_T_OBJECT, offsetof(PyEncoderObject, markers), Py_READONLY, "markers"},
+ {"default", _Py_T_OBJECT, offsetof(PyEncoderObject, defaultfn), Py_READONLY, "default"},
+ {"encoder", _Py_T_OBJECT, offsetof(PyEncoderObject, encoder), Py_READONLY, "encoder"},
+ {"indent", _Py_T_OBJECT, offsetof(PyEncoderObject, indent), Py_READONLY, "indent"},
+ {"key_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, key_separator), Py_READONLY, "key_separator"},
+ {"item_separator", _Py_T_OBJECT, offsetof(PyEncoderObject, item_separator), Py_READONLY, "item_separator"},
+ {"sort_keys", Py_T_BOOL, offsetof(PyEncoderObject, sort_keys), Py_READONLY, "sort_keys"},
+ {"skipkeys", Py_T_BOOL, offsetof(PyEncoderObject, skipkeys), Py_READONLY, "skipkeys"},
{NULL}
};
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index edb2e3673f0..c548f8fa383 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -6,7 +6,7 @@
*/
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
#include <stdlib.h> // free()
#include <string.h>
@@ -1338,13 +1338,13 @@ PyDoc_STRVAR(Decompressor_unused_data_doc,
"Data found after the end of the compressed stream.");
static PyMemberDef Decompressor_members[] = {
- {"check", T_INT, offsetof(Decompressor, check), READONLY,
+ {"check", Py_T_INT, offsetof(Decompressor, check), Py_READONLY,
Decompressor_check_doc},
- {"eof", T_BOOL, offsetof(Decompressor, eof), READONLY,
+ {"eof", Py_T_BOOL, offsetof(Decompressor, eof), Py_READONLY,
Decompressor_eof_doc},
- {"needs_input", T_BOOL, offsetof(Decompressor, needs_input), READONLY,
+ {"needs_input", Py_T_BOOL, offsetof(Decompressor, needs_input), Py_READONLY,
Decompressor_needs_input_doc},
- {"unused_data", T_OBJECT_EX, offsetof(Decompressor, unused_data), READONLY,
+ {"unused_data", Py_T_OBJECT_EX, offsetof(Decompressor, unused_data), Py_READONLY,
Decompressor_unused_data_doc},
{NULL}
};
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 897b8db7110..771f86e5367 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -734,13 +734,13 @@ static PyMethodDef semlock_methods[] = {
*/
static PyMemberDef semlock_members[] = {
- {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), READONLY,
+ {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), Py_READONLY,
""},
- {"kind", T_INT, offsetof(SemLockObject, kind), READONLY,
+ {"kind", Py_T_INT, offsetof(SemLockObject, kind), Py_READONLY,
""},
- {"maxvalue", T_INT, offsetof(SemLockObject, maxvalue), READONLY,
+ {"maxvalue", Py_T_INT, offsetof(SemLockObject, maxvalue), Py_READONLY,
""},
- {"name", T_STRING, offsetof(SemLockObject, name), READONLY,
+ {"name", Py_T_STRING, offsetof(SemLockObject, name), Py_READONLY,
""},
{NULL}
};
diff --git a/Modules/_operator.c b/Modules/_operator.c
index 108f45fb6da..b59bfe9ac32 100644
--- a/Modules/_operator.c
+++ b/Modules/_operator.c
@@ -3,7 +3,7 @@
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_runtime.h" // _Py_ID()
-#include "structmember.h" // PyMemberDef
+
#include "clinic/_operator.c.h"
typedef struct {
@@ -1153,7 +1153,7 @@ static PyMethodDef itemgetter_methods[] = {
};
static PyMemberDef itemgetter_members[] = {
- {"__vectorcalloffset__", T_PYSSIZET, offsetof(itemgetterobject, vectorcall), READONLY},
+ {"__vectorcalloffset__", Py_T_PYSSIZET, offsetof(itemgetterobject, vectorcall), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -1508,7 +1508,7 @@ static PyMethodDef attrgetter_methods[] = {
};
static PyMemberDef attrgetter_members[] = {
- {"__vectorcalloffset__", T_PYSSIZET, offsetof(attrgetterobject, vectorcall), READONLY},
+ {"__vectorcalloffset__", Py_T_PYSSIZET, offsetof(attrgetterobject, vectorcall), Py_READONLY},
{NULL} /* Sentinel*/
};
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index d9395e35daf..d4c0be78935 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -16,7 +16,7 @@
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_runtime.h" // _Py_ID()
#include "pycore_setobject.h" // _PySet_NextEntry()
-#include "structmember.h" // PyMemberDef
+
#include <stdlib.h> // strtol()
@@ -5074,9 +5074,9 @@ Pickler_set_persid(PicklerObject *self, PyObject *value, void *Py_UNUSED(ignored
}
static PyMemberDef Pickler_members[] = {
- {"bin", T_INT, offsetof(PicklerObject, bin)},
- {"fast", T_INT, offsetof(PicklerObject, fast)},
- {"dispatch_table", T_OBJECT_EX, offsetof(PicklerObject, dispatch_table)},
+ {"bin", Py_T_INT, offsetof(PicklerObject, bin)},
+ {"fast", Py_T_INT, offsetof(PicklerObject, fast)},
+ {"dispatch_table", Py_T_OBJECT_EX, offsetof(PicklerObject, dispatch_table)},
{NULL}
};
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index 69cc05135c2..b0a36f03694 100644
--- a/Modules/_queuemodule.c
+++ b/Modules/_queuemodule.c
@@ -5,7 +5,7 @@
#include "Python.h"
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_time.h" // _PyTime_t
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof()
typedef struct {
@@ -373,7 +373,7 @@ static PyMethodDef simplequeue_methods[] = {
};
static struct PyMemberDef simplequeue_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(simplequeueobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(simplequeueobject, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/_sqlite/blob.c b/Modules/_sqlite/blob.c
index 989d9a83b59..f099020c5f4 100644
--- a/Modules/_sqlite/blob.c
+++ b/Modules/_sqlite/blob.c
@@ -577,7 +577,7 @@ static PyMethodDef blob_methods[] = {
};
static struct PyMemberDef blob_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Blob, in_weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(pysqlite_Blob, in_weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index bab743674b6..ddd7ace8119 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -26,7 +26,7 @@
#endif
#include "module.h"
-#include "structmember.h" // PyMemberDef
+
#include "connection.h"
#include "statement.h"
#include "cursor.h"
@@ -2511,18 +2511,18 @@ static PyMethodDef connection_methods[] = {
static struct PyMemberDef connection_members[] =
{
- {"Warning", T_OBJECT, offsetof(pysqlite_Connection, Warning), READONLY},
- {"Error", T_OBJECT, offsetof(pysqlite_Connection, Error), READONLY},
- {"InterfaceError", T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), READONLY},
- {"DatabaseError", T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), READONLY},
- {"DataError", T_OBJECT, offsetof(pysqlite_Connection, DataError), READONLY},
- {"OperationalError", T_OBJECT, offsetof(pysqlite_Connection, OperationalError), READONLY},
- {"IntegrityError", T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), READONLY},
- {"InternalError", T_OBJECT, offsetof(pysqlite_Connection, InternalError), READONLY},
- {"ProgrammingError", T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), READONLY},
- {"NotSupportedError", T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), READONLY},
- {"row_factory", T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
- {"text_factory", T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
+ {"Warning", _Py_T_OBJECT, offsetof(pysqlite_Connection, Warning), Py_READONLY},
+ {"Error", _Py_T_OBJECT, offsetof(pysqlite_Connection, Error), Py_READONLY},
+ {"InterfaceError", _Py_T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), Py_READONLY},
+ {"DatabaseError", _Py_T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), Py_READONLY},
+ {"DataError", _Py_T_OBJECT, offsetof(pysqlite_Connection, DataError), Py_READONLY},
+ {"OperationalError", _Py_T_OBJECT, offsetof(pysqlite_Connection, OperationalError), Py_READONLY},
+ {"IntegrityError", _Py_T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), Py_READONLY},
+ {"InternalError", _Py_T_OBJECT, offsetof(pysqlite_Connection, InternalError), Py_READONLY},
+ {"ProgrammingError", _Py_T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), Py_READONLY},
+ {"NotSupportedError", _Py_T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), Py_READONLY},
+ {"row_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
+ {"text_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
{NULL}
};
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index dba8ab61e41..618ce532b25 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -1325,13 +1325,13 @@ static PyMethodDef cursor_methods[] = {
static struct PyMemberDef cursor_members[] =
{
- {"connection", T_OBJECT, offsetof(pysqlite_Cursor, connection), READONLY},
- {"description", T_OBJECT, offsetof(pysqlite_Cursor, description), READONLY},
- {"arraysize", T_INT, offsetof(pysqlite_Cursor, arraysize), 0},
- {"lastrowid", T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), READONLY},
- {"rowcount", T_LONG, offsetof(pysqlite_Cursor, rowcount), READONLY},
- {"row_factory", T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(pysqlite_Cursor, in_weakreflist), READONLY},
+ {"connection", _Py_T_OBJECT, offsetof(pysqlite_Cursor, connection), Py_READONLY},
+ {"description", _Py_T_OBJECT, offsetof(pysqlite_Cursor, description), Py_READONLY},
+ {"arraysize", Py_T_INT, offsetof(pysqlite_Cursor, arraysize), 0},
+ {"lastrowid", _Py_T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), Py_READONLY},
+ {"rowcount", Py_T_LONG, offsetof(pysqlite_Cursor, rowcount), Py_READONLY},
+ {"row_factory", _Py_T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(pysqlite_Cursor, in_weakreflist), Py_READONLY},
{NULL}
};
diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c
index ddbdc9f478a..c4e43a0db0f 100644
--- a/Modules/_sre/sre.c
+++ b/Modules/_sre/sre.c
@@ -41,7 +41,7 @@ static const char copyright[] =
#include "Python.h"
#include "pycore_long.h" // _PyLong_GetZero()
#include "pycore_moduleobject.h" // _PyModule_GetState()
-#include "structmember.h" // PyMemberDef
+
#include "sre.h"
@@ -2994,13 +2994,13 @@ static PyGetSetDef pattern_getset[] = {
#define PAT_OFF(x) offsetof(PatternObject, x)
static PyMemberDef pattern_members[] = {
- {"pattern", T_OBJECT, PAT_OFF(pattern), READONLY,
+ {"pattern", _Py_T_OBJECT, PAT_OFF(pattern), Py_READONLY,
"The pattern string from which the RE object was compiled."},
- {"flags", T_INT, PAT_OFF(flags), READONLY,
+ {"flags", Py_T_INT, PAT_OFF(flags), Py_READONLY,
"The regex matching flags."},
- {"groups", T_PYSSIZET, PAT_OFF(groups), READONLY,
+ {"groups", Py_T_PYSSIZET, PAT_OFF(groups), Py_READONLY,
"The number of capturing groups in the pattern."},
- {"__weaklistoffset__", T_PYSSIZET, offsetof(PatternObject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(PatternObject, weakreflist), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -3053,13 +3053,13 @@ static PyGetSetDef match_getset[] = {
#define MATCH_OFF(x) offsetof(MatchObject, x)
static PyMemberDef match_members[] = {
- {"string", T_OBJECT, MATCH_OFF(string), READONLY,
+ {"string", _Py_T_OBJECT, MATCH_OFF(string), Py_READONLY,
"The string passed to match() or search()."},
- {"re", T_OBJECT, MATCH_OFF(pattern), READONLY,
+ {"re", _Py_T_OBJECT, MATCH_OFF(pattern), Py_READONLY,
"The regular expression object."},
- {"pos", T_PYSSIZET, MATCH_OFF(pos), READONLY,
+ {"pos", Py_T_PYSSIZET, MATCH_OFF(pos), Py_READONLY,
"The index into the string at which the RE engine started looking for a match."},
- {"endpos", T_PYSSIZET, MATCH_OFF(endpos), READONLY,
+ {"endpos", Py_T_PYSSIZET, MATCH_OFF(endpos), Py_READONLY,
"The index into the string beyond which the RE engine will not go."},
{NULL}
};
@@ -3103,7 +3103,7 @@ static PyMethodDef scanner_methods[] = {
#define SCAN_OFF(x) offsetof(ScannerObject, x)
static PyMemberDef scanner_members[] = {
- {"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
+ {"pattern", _Py_T_OBJECT, SCAN_OFF(pattern), Py_READONLY},
{NULL} /* Sentinel */
};
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 31c94927e91..425715ad030 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -10,8 +10,9 @@
#include "Python.h"
#include "pycore_bytesobject.h" // _PyBytesWriter
#include "pycore_moduleobject.h" // _PyModule_GetState()
-#include "structmember.h" // PyMemberDef
+
#include <ctype.h>
+#include <stddef.h> // offsetof()
/*[clinic input]
class Struct "PyStructObject *" "&PyStructType"
@@ -2176,7 +2177,7 @@ static struct PyMethodDef s_methods[] = {
};
static PyMemberDef s_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(PyStructObject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(PyStructObject, weakreflist), Py_READONLY},
{NULL} /* sentinel */
};
diff --git a/Modules/_testcapi/buffer.c b/Modules/_testcapi/buffer.c
index aff9a477eff..942774156c6 100644
--- a/Modules/_testcapi/buffer.c
+++ b/Modules/_testcapi/buffer.c
@@ -2,7 +2,7 @@
#include "parts.h"
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof
typedef struct {
@@ -72,7 +72,7 @@ static PyBufferProcs testbuf_as_buffer = {
};
static struct PyMemberDef testbuf_members[] = {
- {"references", T_PYSSIZET, offsetof(testBufObject, references), READONLY},
+ {"references", Py_T_PYSSIZET, offsetof(testBufObject, references), Py_READONLY},
{NULL},
};
diff --git a/Modules/_testcapi/heaptype.c b/Modules/_testcapi/heaptype.c
index 2da06f447af..d14a1763184 100644
--- a/Modules/_testcapi/heaptype.c
+++ b/Modules/_testcapi/heaptype.c
@@ -1,5 +1,6 @@
#include "parts.h"
-#include "structmember.h" // PyMemberDef
+#include <stddef.h> // offsetof()
+
static struct PyModuleDef *_testcapimodule = NULL; // set at initialization
@@ -332,7 +333,7 @@ typedef struct {
static struct PyMemberDef members_to_repeat[] = {
- {"T_INT", T_INT, offsetof(HeapCTypeWithDataObject, data), 0, NULL},
+ {"Py_T_INT", Py_T_INT, offsetof(HeapCTypeWithDataObject, data), 0, NULL},
{NULL}
};
@@ -477,7 +478,7 @@ typedef struct {
} HeapCTypeObject;
static struct PyMemberDef heapctype_members[] = {
- {"value", T_INT, offsetof(HeapCTypeObject, value)},
+ {"value", Py_T_INT, offsetof(HeapCTypeObject, value)},
{NULL} /* Sentinel */
};
@@ -571,7 +572,7 @@ heapctypesubclass_init(PyObject *self, PyObject *args, PyObject *kwargs)
}
static struct PyMemberDef heapctypesubclass_members[] = {
- {"value2", T_INT, offsetof(HeapCTypeSubclassObject, value2)},
+ {"value2", Py_T_INT, offsetof(HeapCTypeSubclassObject, value2)},
{NULL} /* Sentinel */
};
@@ -772,8 +773,8 @@ static PyGetSetDef heapctypewithdict_getsetlist[] = {
};
static struct PyMemberDef heapctypewithdict_members[] = {
- {"dictobj", T_OBJECT, offsetof(HeapCTypeWithDictObject, dict)},
- {"__dictoffset__", T_PYSSIZET, offsetof(HeapCTypeWithDictObject, dict), READONLY},
+ {"dictobj", _Py_T_OBJECT, offsetof(HeapCTypeWithDictObject, dict)},
+ {"__dictoffset__", Py_T_PYSSIZET, offsetof(HeapCTypeWithDictObject, dict), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -867,8 +868,8 @@ static PyType_Spec HeapCTypeWithManagedWeakref_spec = {
};
static struct PyMemberDef heapctypewithnegativedict_members[] = {
- {"dictobj", T_OBJECT, offsetof(HeapCTypeWithDictObject, dict)},
- {"__dictoffset__", T_PYSSIZET, -(Py_ssize_t)sizeof(void*), READONLY},
+ {"dictobj", _Py_T_OBJECT, offsetof(HeapCTypeWithDictObject, dict)},
+ {"__dictoffset__", Py_T_PYSSIZET, -(Py_ssize_t)sizeof(void*), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -893,9 +894,9 @@ typedef struct {
} HeapCTypeWithWeakrefObject;
static struct PyMemberDef heapctypewithweakref_members[] = {
- {"weakreflist", T_OBJECT, offsetof(HeapCTypeWithWeakrefObject, weakreflist)},
- {"__weaklistoffset__", T_PYSSIZET,
- offsetof(HeapCTypeWithWeakrefObject, weakreflist), READONLY},
+ {"weakreflist", _Py_T_OBJECT, offsetof(HeapCTypeWithWeakrefObject, weakreflist)},
+ {"__weaklistoffset__", Py_T_PYSSIZET,
+ offsetof(HeapCTypeWithWeakrefObject, weakreflist), Py_READONLY},
{NULL} /* Sentinel */
};
@@ -943,7 +944,7 @@ typedef struct {
} HeapCTypeSetattrObject;
static struct PyMemberDef heapctypesetattr_members[] = {
- {"pvalue", T_LONG, offsetof(HeapCTypeSetattrObject, value)},
+ {"pvalue", Py_T_LONG, offsetof(HeapCTypeSetattrObject, value)},
{NULL} /* Sentinel */
};
diff --git a/Modules/_testcapi/vectorcall.c b/Modules/_testcapi/vectorcall.c
index 5ee468bd28c..61c6e0f485f 100644
--- a/Modules/_testcapi/vectorcall.c
+++ b/Modules/_testcapi/vectorcall.c
@@ -1,7 +1,7 @@
#include "parts.h"
#include "clinic/vectorcall.c.h"
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof
/*[clinic input]
@@ -197,7 +197,7 @@ PyMethodDef VectorCallClass_methods[] = {
};
PyMemberDef VectorCallClass_members[] = {
- {"__vectorcalloffset__", T_PYSSIZET, 0/* set later */, READONLY},
+ {"__vectorcalloffset__", Py_T_PYSSIZET, 0/* set later */, Py_READONLY},
{NULL}
};
diff --git a/Modules/_testcapi/vectorcall_limited.c b/Modules/_testcapi/vectorcall_limited.c
index a69f1d3f2a7..a96925e8401 100644
--- a/Modules/_testcapi/vectorcall_limited.c
+++ b/Modules/_testcapi/vectorcall_limited.c
@@ -3,7 +3,7 @@
#ifdef LIMITED_API_AVAILABLE
-#include "structmember.h" // PyMemberDef
+
/* Test Vectorcall in the limited API */
@@ -132,7 +132,7 @@ leave:
}
static PyMemberDef LimitedVectorCallClass_members[] = {
- {"__vectorcalloffset__", T_PYSSIZET, sizeof(PyObject), READONLY},
+ {"__vectorcalloffset__", Py_T_PYSSIZET, sizeof(PyObject), Py_READONLY},
{NULL}
};
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 065a7fb733d..2286a925e36 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -20,15 +20,16 @@
#include "Python.h"
#include "frameobject.h" // PyFrame_New
#include "marshal.h" // PyMarshal_WriteLongToFile
-#include "structmember.h" // for offsetof(), T_OBJECT
+
#include <float.h> // FLT_MAX
#include <signal.h>
+#include <stddef.h> // offsetof()
#ifndef MS_WINDOWS
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h> // W_STOPCODE
+# include <sys/wait.h> // W_STOPCODE
#endif
#ifdef Py_BUILD_CORE
@@ -4257,7 +4258,7 @@ ContainerNoGC_dealloc(ContainerNoGCobject *self)
}
static PyMemberDef ContainerNoGC_members[] = {
- {"value", T_OBJECT, offsetof(ContainerNoGCobject, value), READONLY,
+ {"value", _Py_T_OBJECT, offsetof(ContainerNoGCobject, value), Py_READONLY,
PyDoc_STR("a container value for test purposes")},
{0}
};
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index d8a797f34db..52f44d04523 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -9,7 +9,7 @@
#include "pycore_pystate.h" // _PyThreadState_SetCurrent()
#include "pycore_weakref.h" // _PyWeakref_GET_REF()
#include <stddef.h> // offsetof()
-#include "structmember.h" // PyMemberDef
+
#ifdef HAVE_SIGNAL_H
# include <signal.h> // SIGINT
@@ -293,7 +293,7 @@ unlock it. A thread attempting to lock a lock that it has already locked\n\
will block until another thread unlocks it. Deadlocks may ensue.");
static PyMemberDef lock_type_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(lockobject, in_weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(lockobject, in_weakreflist), Py_READONLY},
{NULL},
};
@@ -575,7 +575,7 @@ static PyMethodDef rlock_methods[] = {
static PyMemberDef rlock_type_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(rlockobject, in_weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(rlockobject, in_weakreflist), Py_READONLY},
{NULL},
};
@@ -679,7 +679,7 @@ localdummy_dealloc(localdummyobject *self)
}
static PyMemberDef local_dummy_type_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(localdummyobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(localdummyobject, weakreflist), Py_READONLY},
{NULL},
};
@@ -959,7 +959,7 @@ local_setattro(localobject *self, PyObject *name, PyObject *v)
static PyObject *local_getattro(localobject *, PyObject *);
static PyMemberDef local_type_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(localobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(localobject, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 313c12a34c6..0edb36d18dd 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -38,7 +38,7 @@
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_pylifecycle.h" // _Py_IsInterpreterFinalizing()
#include "pycore_pystate.h" // _PyInterpreterState_GET
-#include "structmember.h" // PyMemberDef
+
#ifndef WINDOWS_LEAN_AND_MEAN
@@ -54,13 +54,13 @@
PyLong_FromUnsignedLong((unsigned long) handle)
#define PYNUM_TO_HANDLE(obj) ((HANDLE)PyLong_AsUnsignedLong(obj))
#define F_POINTER "k"
-#define T_POINTER T_ULONG
+#define T_POINTER Py_T_ULONG
#else
#define HANDLE_TO_PYNUM(handle) \
PyLong_FromUnsignedLongLong((unsigned long long) handle)
#define PYNUM_TO_HANDLE(obj) ((HANDLE)PyLong_AsUnsignedLongLong(obj))
#define F_POINTER "K"
-#define T_POINTER T_ULONGLONG
+#define T_POINTER Py_T_ULONGLONG
#endif
#define F_HANDLE F_POINTER
@@ -322,7 +322,7 @@ static PyMethodDef overlapped_methods[] = {
static PyMemberDef overlapped_members[] = {
{"event", T_HANDLE,
offsetof(OverlappedObject, overlapped) + offsetof(OVERLAPPED, hEvent),
- READONLY, "overlapped event handle"},
+ Py_READONLY, "overlapped event handle"},
{NULL}
};
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index 0ced9d08b9e..fb0b4b40b2a 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -4,7 +4,7 @@
#include "Python.h"
#include "pycore_long.h" // _PyLong_GetOne()
-#include "structmember.h"
+
#include <ctype.h>
#include <stddef.h>
@@ -2692,13 +2692,13 @@ static PyMethodDef zoneinfo_methods[] = {
static PyMemberDef zoneinfo_members[] = {
{.name = "key",
.offset = offsetof(PyZoneInfo_ZoneInfo, key),
- .type = T_OBJECT_EX,
- .flags = READONLY,
+ .type = Py_T_OBJECT_EX,
+ .flags = Py_READONLY,
.doc = NULL},
{.name = "__weaklistoffset__",
.offset = offsetof(PyZoneInfo_ZoneInfo, weakreflist),
- .type = T_PYSSIZET,
- .flags = READONLY},
+ .type = Py_T_PYSSIZET,
+ .flags = Py_READONLY},
{NULL}, /* Sentinel */
};
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 80a95428ebf..a40a5b75b63 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -11,7 +11,7 @@
#include "pycore_call.h" // _PyObject_CallMethod()
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_bytesobject.h" // _PyBytes_Repeat
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof()
#include <stdbool.h>
@@ -2895,7 +2895,7 @@ itemsize -- the length in bytes of one array item\n\
static PyObject *array_iter(arrayobject *ao);
static struct PyMemberDef array_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(arrayobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(arrayobject, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 3febd1a832f..5d3c16a9842 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -9,10 +9,12 @@
#endif
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
#include "multibytecodec.h"
#include "clinic/multibytecodec.c.h"
+#include <stddef.h> // offsetof()
+
#define MODULE_NAME "_multibytecodec"
typedef struct {
@@ -1611,9 +1613,9 @@ static struct PyMethodDef mbstreamreader_methods[] = {
};
static PyMemberDef mbstreamreader_members[] = {
- {"stream", T_OBJECT,
+ {"stream", _Py_T_OBJECT,
offsetof(MultibyteStreamReaderObject, stream),
- READONLY, NULL},
+ Py_READONLY, NULL},
{NULL,}
};
@@ -1919,9 +1921,9 @@ static struct PyMethodDef mbstreamwriter_methods[] = {
};
static PyMemberDef mbstreamwriter_members[] = {
- {"stream", T_OBJECT,
+ {"stream", _Py_T_OBJECT,
offsetof(MultibyteStreamWriterObject, stream),
- READONLY, NULL},
+ Py_READONLY, NULL},
{NULL,}
};
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index f5f7bf33bf8..0ab6d330e87 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -5,7 +5,7 @@
#include "pycore_typeobject.h" // _PyType_GetModuleState()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "pycore_tuple.h" // _PyTuple_ITEMS()
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof()
/* Itertools module written and maintained
@@ -1090,7 +1090,7 @@ static PyMethodDef tee_methods[] = {
};
static PyMemberDef tee_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(teeobject, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(teeobject, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index cfbd2f41130..5c131570123 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -25,7 +25,7 @@
#include <Python.h>
#include "pycore_bytesobject.h" // _PyBytes_Find()
#include "pycore_fileutils.h" // _Py_stat_struct
-#include "structmember.h" // PyMemberDef
+
#include <stddef.h> // offsetof()
// to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA
@@ -883,7 +883,7 @@ mmap_madvise_method(mmap_object *self, PyObject *args)
#endif // HAVE_MADVISE
static struct PyMemberDef mmap_object_members[] = {
- {"__weaklistoffset__", T_PYSSIZET, offsetof(mmap_object, weakreflist), READONLY},
+ {"__weaklistoffset__", Py_T_PYSSIZET, offsetof(mmap_object, weakreflist), Py_READONLY},
{NULL},
};
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 7d3976faef9..271f6ce7e2d 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -8,7 +8,7 @@
Check itemsize */
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
#define WINDOWS_LEAN_AND_MEAN
#include <winsock2.h>
@@ -17,10 +17,10 @@
#if defined(MS_WIN32) && !defined(MS_WIN64)
# define F_POINTER "k"
-# define T_POINTER T_ULONG
+# define T_POINTER Py_T_ULONG
#else
# define F_POINTER "K"
-# define T_POINTER T_ULONGLONG
+# define T_POINTER Py_T_ULONGLONG
#endif
#define F_HANDLE F_POINTER
@@ -1942,12 +1942,12 @@ static PyMethodDef Overlapped_methods[] = {
};
static PyMemberDef Overlapped_members[] = {
- {"error", T_ULONG,
+ {"error", Py_T_ULONG,
offsetof(OverlappedObject, error),
- READONLY, "Error from last operation"},
+ Py_READONLY, "Error from last operation"},
{"event", T_HANDLE,
offsetof(OverlappedObject, overlapped) + offsetof(OVERLAPPED, hEvent),
- READONLY, "Overlapped event handle"},
+ Py_READONLY, "Overlapped event handle"},
{NULL}
};
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7e04d12a9e4..bab2ac2ccf5 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -36,7 +36,7 @@
# endif /* MS_WINDOWS_DESKTOP | MS_WINDOWS_SYSTEM */
#endif
-#include "structmember.h" // PyMemberDef
+
#ifndef MS_WINDOWS
# include "posixmodule.h"
#else
@@ -14822,9 +14822,9 @@ os_DirEntry___fspath___impl(DirEntry *self)
}
static PyMemberDef DirEntry_members[] = {
- {"name", T_OBJECT_EX, offsetof(DirEntry, name), READONLY,
+ {"name", Py_T_OBJECT_EX, offsetof(DirEntry, name), Py_READONLY,
"the entry's base filename, relative to scandir() \"path\" argument"},
- {"path", T_OBJECT_EX, offsetof(DirEntry, path), READONLY,
+ {"path", Py_T_OBJECT_EX, offsetof(DirEntry, path), Py_READONLY,
"the entry's full path name; equivalent to os.path.join(scandir_path, entry.name)"},
{NULL}
};
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index d8395e9a9aa..a8ce84c0bb9 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -5,11 +5,10 @@
#include "Python.h"
#include "pycore_import.h" // _PyImport_SetModule()
#include "pycore_pyhash.h" // _Py_HashSecret
-#include <ctype.h>
-#include "structmember.h" // PyMemberDef
+#include <ctype.h>
+#include <stddef.h> // offsetof()
#include "expat.h"
-
#include "pyexpat.h"
/* Do not emit Clinic output to a file as that wreaks havoc with conditionally
@@ -1471,7 +1470,7 @@ xmlparse_specified_attributes_setter(xmlparseobject *self, PyObject *v, void *cl
}
static PyMemberDef xmlparse_members[] = {
- {"intern", T_OBJECT, offsetof(xmlparseobject, intern), READONLY, NULL},
+ {"intern", _Py_T_OBJECT, offsetof(xmlparseobject, intern), Py_READONLY, NULL},
{NULL}
};
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 7ab0804ad27..94d246960f4 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -15,7 +15,8 @@
#include "Python.h"
#include "pycore_fileutils.h" // _Py_set_inheritable()
#include "pycore_time.h" // _PyTime_t
-#include "structmember.h" // PyMemberDef
+
+#include <stddef.h> // offsetof()
#ifdef HAVE_SYS_DEVPOLL_H
#include <sys/resource.h>
@@ -1758,18 +1759,18 @@ typedef struct {
#if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P)
# error uintptr_t does not match void *!
#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG)
-# define T_UINTPTRT T_ULONGLONG
-# define T_INTPTRT T_LONGLONG
+# define T_UINTPTRT Py_T_ULONGLONG
+# define T_INTPTRT Py_T_LONGLONG
# define UINTPTRT_FMT_UNIT "K"
# define INTPTRT_FMT_UNIT "L"
#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG)
-# define T_UINTPTRT T_ULONG
-# define T_INTPTRT T_LONG
+# define T_UINTPTRT Py_T_ULONG
+# define T_INTPTRT Py_T_LONG
# define UINTPTRT_FMT_UNIT "k"
# define INTPTRT_FMT_UNIT "l"
#elif (SIZEOF_UINTPTR_T == SIZEOF_INT)
-# define T_UINTPTRT T_UINT
-# define T_INTPTRT T_INT
+# define T_UINTPTRT Py_T_UINT
+# define T_INTPTRT Py_T_INT
# define UINTPTRT_FMT_UNIT "I"
# define INTPTRT_FMT_UNIT "i"
#else
@@ -1777,26 +1778,26 @@ typedef struct {
#endif
#if SIZEOF_LONG_LONG == 8
-# define T_INT64 T_LONGLONG
+# define T_INT64 Py_T_LONGLONG
# define INT64_FMT_UNIT "L"
#elif SIZEOF_LONG == 8
-# define T_INT64 T_LONG
+# define T_INT64 Py_T_LONG
# define INT64_FMT_UNIT "l"
#elif SIZEOF_INT == 8
-# define T_INT64 T_INT
+# define T_INT64 Py_T_INT
# define INT64_FMT_UNIT "i"
#else
# define INT64_FMT_UNIT "_"
#endif
#if SIZEOF_LONG_LONG == 4
-# define T_UINT32 T_ULONGLONG
+# define T_UINT32 Py_T_ULONGLONG
# define UINT32_FMT_UNIT "K"
#elif SIZEOF_LONG == 4
-# define T_UINT32 T_ULONG
+# define T_UINT32 Py_T_ULONG
# define UINT32_FMT_UNIT "k"
#elif SIZEOF_INT == 4
-# define T_UINT32 T_UINT
+# define T_UINT32 Py_T_UINT
# define UINT32_FMT_UNIT "I"
#else
# define UINT32_FMT_UNIT "_"
@@ -1813,11 +1814,11 @@ typedef struct {
# define FFLAGS_TYPE T_UINT32
# define FFLAGS_FMT_UNIT UINT32_FMT_UNIT
#else
-# define FILTER_TYPE T_SHORT
+# define FILTER_TYPE Py_T_SHORT
# define FILTER_FMT_UNIT "h"
-# define FLAGS_TYPE T_USHORT
+# define FLAGS_TYPE Py_T_USHORT
# define FLAGS_FMT_UNIT "H"
-# define FFLAGS_TYPE T_UINT
+# define FFLAGS_TYPE Py_T_UINT
# define FFLAGS_FMT_UNIT "I"
#endif
@@ -1839,7 +1840,7 @@ static struct PyMemberDef kqueue_event_members[] = {
{"ident", T_UINTPTRT, KQ_OFF(e.ident)},
{"filter", FILTER_TYPE, KQ_OFF(e.filter)},
{"flags", FLAGS_TYPE, KQ_OFF(e.flags)},
- {"fflags", T_UINT, KQ_OFF(e.fflags)},
+ {"fflags", Py_T_UINT, KQ_OFF(e.fflags)},
{"data", DATA_TYPE, KQ_OFF(e.data)},
{"udata", T_UINTPTRT, KQ_OFF(e.udata)},
{NULL} /* Sentinel */
diff --git a/Modules/sha2module.c b/Modules/sha2module.c
index db3774c81e2..6ad1ff2e05b 100644
--- a/Modules/sha2module.c
+++ b/Modules/sha2module.c
@@ -25,7 +25,7 @@
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_typeobject.h" // _PyType_GetModuleState()
#include "pycore_strhex.h" // _Py_strhex()
-#include "structmember.h" // PyMemberDef
+
#include "hashlib.h"
/*[clinic input]
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 39bbc911712..fc6a7f994bf 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -108,7 +108,7 @@ Local naming conventions:
#include "Python.h"
#include "pycore_fileutils.h" // _Py_set_inheritable()
#include "pycore_moduleobject.h" // _PyModule_GetState
-#include "structmember.h" // PyMemberDef
+
#ifdef _Py_MEMORY_SANITIZER
# include <sanitizer/msan_interface.h>
@@ -5205,9 +5205,9 @@ static PyMethodDef sock_methods[] = {
/* SockObject members */
static PyMemberDef sock_memberlist[] = {
- {"family", T_INT, offsetof(PySocketSockObject, sock_family), READONLY, "the socket family"},
- {"type", T_INT, offsetof(PySocketSockObject, sock_type), READONLY, "the socket type"},
- {"proto", T_INT, offsetof(PySocketSockObject, sock_proto), READONLY, "the socket protocol"},
+ {"family", Py_T_INT, offsetof(PySocketSockObject, sock_family), Py_READONLY, "the socket family"},
+ {"type", Py_T_INT, offsetof(PySocketSockObject, sock_type), Py_READONLY, "the socket type"},
+ {"proto", Py_T_INT, offsetof(PySocketSockObject, sock_proto), Py_READONLY, "the socket protocol"},
{0},
};
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 6267c5ae29a..c1e22f38689 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -18,9 +18,9 @@
#include "Python.h"
#include "pycore_ucnhash.h" // _PyUnicode_Name_CAPI
-#include "structmember.h" // PyMemberDef
#include <stdbool.h>
+#include <stddef.h> // offsetof()
/*[clinic input]
module unicodedata
@@ -82,7 +82,7 @@ typedef struct previous_version {
#define get_old_record(self, v) ((((PreviousDBVersion*)self)->getrecord)(v))
static PyMemberDef DB_members[] = {
- {"unidata_version", T_STRING, offsetof(PreviousDBVersion, name), READONLY},
+ {"unidata_version", Py_T_STRING, offsetof(PreviousDBVersion, name), Py_READONLY},
{NULL}
};
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c
index 9e4a3d66ef4..63b22268c59 100644
--- a/Modules/xxsubtype.c
+++ b/Modules/xxsubtype.c
@@ -1,5 +1,6 @@
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+#include <stddef.h> // offsetof()
+
PyDoc_STRVAR(xxsubtype__doc__,
"xxsubtype is an example module showing how to subtype builtin types from C.\n"
@@ -181,7 +182,7 @@ spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds)
}
static PyMemberDef spamdict_members[] = {
- {"state", T_INT, offsetof(spamdictobject, state), READONLY,
+ {"state", Py_T_INT, offsetof(spamdictobject, state), Py_READONLY,
PyDoc_STR("an int variable for demonstration purposes")},
{0}
};
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 9970bc9e5ad..22da50989a8 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -4,7 +4,7 @@
/* Windows users: read Python's PCbuild\readme.txt */
#include "Python.h"
-#include "structmember.h" // PyMemberDef
+
#include "zlib.h"
#include "stdbool.h"
@@ -1344,7 +1344,7 @@ typedef struct {
decompress_buf() */
Py_ssize_t avail_in_real;
bool is_initialised;
- char eof; /* T_BOOL expects a char */
+ char eof; /* Py_T_BOOL expects a char */
char needs_input;
} ZlibDecompressor;
@@ -1801,9 +1801,9 @@ static PyMethodDef ZlibDecompressor_methods[] = {
#define COMP_OFF(x) offsetof(compobject, x)
static PyMemberDef Decomp_members[] = {
- {"unused_data", T_OBJECT, COMP_OFF(unused_data), READONLY},
- {"unconsumed_tail", T_OBJECT, COMP_OFF(unconsumed_tail), READONLY},
- {"eof", T_BOOL, COMP_OFF(eof), READONLY},
+ {"unused_data", _Py_T_OBJECT, COMP_OFF(unused_data), Py_READONLY},
+ {"unconsumed_tail", _Py_T_OBJECT, COMP_OFF(unconsumed_tail), Py_READONLY},
+ {"eof", Py_T_BOOL, COMP_OFF(eof), Py_READONLY},
{NULL},
};
@@ -1817,11 +1817,11 @@ PyDoc_STRVAR(ZlibDecompressor_needs_input_doc,
"True if more input is needed before more decompressed data can be produced.");
static PyMemberDef ZlibDecompressor_members[] = {
- {"eof", T_BOOL, offsetof(ZlibDecompressor, eof),
- READONLY, ZlibDecompressor_eof__doc__},
- {"unused_data", T_OBJECT_EX, offsetof(ZlibDecompressor, unused_data),
- READONLY, ZlibDecompressor_unused_data__doc__},
- {"needs_input", T_BOOL, offsetof(ZlibDecompressor, needs_input), READONLY,
+ {"eof", Py_T_BOOL, offsetof(ZlibDecompressor, eof),
+ Py_READONLY, ZlibDecompressor_eof__doc__},
+ {"unused_data", Py_T_OBJECT_EX, offsetof(ZlibDecompressor, unused_data),
+ Py_READONLY, ZlibDecompressor_unused_data__doc__},
+ {"needs_input", Py_T_BOOL, offsetof(ZlibDecompressor, needs_input), Py_READONLY,
ZlibDecompressor_needs_input_doc},
{NULL},
};