File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff 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 ; /* not used for static types (see gh-94673) */
221+ PyObject * tp_subclasses ; /* for static builtin types this is an index */
222222 PyObject * tp_weaklist ;
223223 destructor tp_del ;
224224
@@ -227,7 +227,6 @@ struct _typeobject {
227227
228228 destructor tp_finalize ;
229229 vectorcallfunc tp_vectorcall ;
230- size_t tp_static_builtin_index ; /* 0 means "not initialized" */
231230};
232231
233232/* 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);
7373static inline int
7474static_builtin_index_is_set (PyTypeObject * self )
7575{
76- return self -> tp_static_builtin_index > 0 ;
76+ return self -> tp_subclasses != NULL ;
7777}
7878
7979static inline size_t
8080static_builtin_index_get (PyTypeObject * self )
8181{
8282 assert (static_builtin_index_is_set (self ));
8383 /* 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 ;
8585}
8686
8787static inline void
8888static_builtin_index_set (PyTypeObject * self , size_t index )
8989{
9090 assert (index < _Py_MAX_STATIC_BUILTIN_TYPES );
9191 /* 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 ) ;
9393}
9494
9595static inline void
9696static_builtin_index_clear (PyTypeObject * self )
9797{
98- self -> tp_static_builtin_index = 0 ;
98+ self -> tp_subclasses = NULL ;
9999}
100100
101101static inline static_builtin_state *
You can’t perform that action at this time.
0 commit comments