File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ struct _typeobject {
218
218
PyObject * tp_bases ;
219
219
PyObject * tp_mro ; /* method resolution order */
220
220
PyObject * tp_cache ; /* no longer used */
221
- PyObject * tp_subclasses ; /* not used for static types (see gh-94673) */
221
+ PyObject * tp_subclasses ; /* for static builtin types this is an index */
222
222
PyObject * tp_weaklist ;
223
223
destructor tp_del ;
224
224
@@ -227,7 +227,6 @@ struct _typeobject {
227
227
228
228
destructor tp_finalize ;
229
229
vectorcallfunc tp_vectorcall ;
230
- size_t tp_static_builtin_index ; /* 0 means "not initialized" */
231
230
};
232
231
233
232
/* This struct is used by the specializer
Original file line number Diff line number Diff line change @@ -73,29 +73,29 @@ static inline PyTypeObject * subclass_from_ref(PyObject *ref);
73
73
static inline int
74
74
static_builtin_index_is_set (PyTypeObject * self )
75
75
{
76
- return self -> tp_static_builtin_index > 0 ;
76
+ return self -> tp_subclasses != NULL ;
77
77
}
78
78
79
79
static inline size_t
80
80
static_builtin_index_get (PyTypeObject * self )
81
81
{
82
82
assert (static_builtin_index_is_set (self ));
83
83
/* We store a 1-based index so 0 can mean "not initialized". */
84
- return self -> tp_static_builtin_index - 1 ;
84
+ return ( size_t ) self -> tp_subclasses - 1 ;
85
85
}
86
86
87
87
static inline void
88
88
static_builtin_index_set (PyTypeObject * self , size_t index )
89
89
{
90
90
assert (index < _Py_MAX_STATIC_BUILTIN_TYPES );
91
91
/* We store a 1-based index so 0 can mean "not initialized". */
92
- self -> tp_static_builtin_index = index + 1 ;
92
+ self -> tp_subclasses = ( PyObject * )( index + 1 ) ;
93
93
}
94
94
95
95
static inline void
96
96
static_builtin_index_clear (PyTypeObject * self )
97
97
{
98
- self -> tp_static_builtin_index = 0 ;
98
+ self -> tp_subclasses = NULL ;
99
99
}
100
100
101
101
static inline static_builtin_state *
You can’t perform that action at this time.
0 commit comments