Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e329f74

Browse filesBrowse files
authored
GH-132330: Synchronise Doc/includes/typestruct.h with PyTypeObject (#132332)
1 parent d687900 commit e329f74
Copy full SHA for e329f74

File tree

Expand file treeCollapse file tree

1 file changed

+17
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-8
lines changed

‎Doc/includes/typestruct.h

Copy file name to clipboardExpand all lines: Doc/includes/typestruct.h
+17-8Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ typedef struct _typeobject {
5454
iternextfunc tp_iternext;
5555

5656
/* Attribute descriptor and subclassing stuff */
57-
struct PyMethodDef *tp_methods;
58-
struct PyMemberDef *tp_members;
59-
struct PyGetSetDef *tp_getset;
57+
PyMethodDef *tp_methods;
58+
PyMemberDef *tp_members;
59+
PyGetSetDef *tp_getset;
6060
// Strong reference on a heap type, borrowed reference on a static type
61-
struct _typeobject *tp_base;
61+
PyTypeObject *tp_base;
6262
PyObject *tp_dict;
6363
descrgetfunc tp_descr_get;
6464
descrsetfunc tp_descr_set;
@@ -70,17 +70,26 @@ typedef struct _typeobject {
7070
inquiry tp_is_gc; /* For PyObject_IS_GC */
7171
PyObject *tp_bases;
7272
PyObject *tp_mro; /* method resolution order */
73-
PyObject *tp_cache;
74-
PyObject *tp_subclasses;
75-
PyObject *tp_weaklist;
73+
PyObject *tp_cache; /* no longer used */
74+
void *tp_subclasses; /* for static builtin types this is an index */
75+
PyObject *tp_weaklist; /* not used for static builtin types */
7676
destructor tp_del;
7777

78-
/* Type attribute cache version tag. Added in version 2.6 */
78+
/* Type attribute cache version tag. Added in version 2.6.
79+
* If zero, the cache is invalid and must be initialized.
80+
*/
7981
unsigned int tp_version_tag;
8082

8183
destructor tp_finalize;
8284
vectorcallfunc tp_vectorcall;
8385

8486
/* bitset of which type-watchers care about this type */
8587
unsigned char tp_watched;
88+
89+
/* Number of tp_version_tag values used.
90+
* Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is
91+
* disabled for this type (e.g. due to custom MRO entries).
92+
* Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).
93+
*/
94+
uint16_t tp_versions_used;
8695
} PyTypeObject;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.