summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-27 23:39:52 (GMT)
committerGitHub <noreply@github.com>2022-01-27 23:39:52 (GMT)
commit18ea973c21ee4a6adc26be41027881043fa498eb (patch)
tree4d9f76fd0c776453372d81c83f48a6fc8cfab6ce /Objects
parent0575551f69ba9c999835bfb176a543d468083c03 (diff)
downloadcpython-18ea973c21ee4a6adc26be41027881043fa498eb.zip
cpython-18ea973c21ee4a6adc26be41027881043fa498eb.tar.gz
cpython-18ea973c21ee4a6adc26be41027881043fa498eb.tar.bz2
bpo-40170: Remove PyHeapType_GET_MEMBERS() macro (GH-30942)
Remove the PyHeapType_GET_MEMBERS() macro. It was exposed in the public C API by mistake, it must only be used by Python internally. Use the PyTypeObject.tp_members member instead. Rename PyHeapType_GET_MEMBERS() to _PyHeapType_GET_MEMBERS() and move it to the internal C API.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 39e8b46..621ad97 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1209,7 +1209,7 @@ traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg)
PyMemberDef *mp;
n = Py_SIZE(type);
- mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
+ mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX) {
char *addr = (char *)self + mp->offset;
@@ -1281,7 +1281,7 @@ clear_slots(PyTypeObject *type, PyObject *self)
PyMemberDef *mp;
n = Py_SIZE(type);
- mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
+ mp = _PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) {
char *addr = (char *)self + mp->offset;
@@ -2977,7 +2977,7 @@ type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
PyHeapTypeObject *et = (PyHeapTypeObject *)type;
Py_ssize_t slotoffset = ctx->base->tp_basicsize;
if (et->ht_slots != NULL) {
- PyMemberDef *mp = PyHeapType_GET_MEMBERS(et);
+ PyMemberDef *mp = _PyHeapType_GET_MEMBERS(et);
Py_ssize_t nslot = PyTuple_GET_SIZE(et->ht_slots);
for (Py_ssize_t i = 0; i < nslot; i++, mp++) {
mp->name = PyUnicode_AsUTF8(
@@ -3014,7 +3014,7 @@ type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
type->tp_basicsize = slotoffset;
type->tp_itemsize = ctx->base->tp_itemsize;
- type->tp_members = PyHeapType_GET_MEMBERS(et);
+ type->tp_members = _PyHeapType_GET_MEMBERS(et);
return 0;
}
@@ -3570,8 +3570,8 @@ PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
else if (slot->slot == Py_tp_members) {
/* Move the slots to the heap type itself */
size_t len = Py_TYPE(type)->tp_itemsize * nmembers;
- memcpy(PyHeapType_GET_MEMBERS(res), slot->pfunc, len);
- type->tp_members = PyHeapType_GET_MEMBERS(res);
+ memcpy(_PyHeapType_GET_MEMBERS(res), slot->pfunc, len);
+ type->tp_members = _PyHeapType_GET_MEMBERS(res);
}
else {
/* Copy other slots directly */