Skip to content

Commit 12d682a

Browse files
Make tp_subclasses void*.
1 parent 62a48da commit 12d682a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Doc/c-api/typeobj.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Quick Reference
135135
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
136136
| [:c:member:`~PyTypeObject.tp_cache`] | :c:type:`PyObject` * | | | | |
137137
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
138-
| [:c:member:`~PyTypeObject.tp_subclasses`] | :c:type:`PyObject` * | __subclasses__ | | | |
138+
| [:c:member:`~PyTypeObject.tp_subclasses`] | void * | __subclasses__ | | | |
139139
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
140140
| [:c:member:`~PyTypeObject.tp_weaklist`] | :c:type:`PyObject` * | | | | |
141141
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
@@ -1936,8 +1936,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19361936

19371937
Internals detail: For the static builtin types this field no longer
19381938
holds the subclasses. Those are now stored on ``PyInterpreterState``.
1939-
This field is re-purposed to hold the index into the type's storage
1940-
on each interpreter state.
1939+
For static builtin types, this field is re-purposed to hold the index
1940+
into the type's storage on each interpreter state.
19411941

19421942
**Inheritance:**
19431943

Include/cpython/object.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ struct _typeobject {
218218
PyObject *tp_bases;
219219
PyObject *tp_mro; /* method resolution order */
220220
PyObject *tp_cache; /* no longer used */
221-
PyObject *tp_subclasses; /* for static builtin types this is an index */
221+
void *tp_subclasses; /* for static builtin types this is an index */
222222
PyObject *tp_weaklist;
223223
destructor tp_del;
224224

Objects/typeobject.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4427,7 +4427,7 @@ lookup_subclasses(PyTypeObject *self)
44274427
assert(state != NULL);
44284428
return state->tp_subclasses;
44294429
}
4430-
return self->tp_subclasses;
4430+
return (PyObject *)self->tp_subclasses;
44314431
}
44324432

44334433
int
@@ -6844,7 +6844,7 @@ init_subclasses(PyTypeObject *self)
68446844
state->tp_subclasses = subclasses;
68456845
return subclasses;
68466846
}
6847-
self->tp_subclasses = subclasses;
6847+
self->tp_subclasses = (void *)subclasses;
68486848
return subclasses;
68496849
}
68506850

0 commit comments

Comments
 (0)