@@ -105,8 +105,6 @@ pub(super) unsafe fn try_trace_obj<T: PyPayload>(x: &PyObject, tracer_fn: &mut T
105105#[ repr( C ) ]
106106pub ( super ) struct PyInner < T > {
107107 pub ( super ) ref_count : RefCount ,
108- // TODO: move typeid into vtable once TypeId::of is const
109- pub ( super ) typeid : TypeId ,
110108 pub ( super ) vtable : & ' static PyObjVTable ,
111109
112110 pub ( super ) typ : PyAtomicRef < PyType > , // __class__ member
@@ -449,7 +447,6 @@ impl<T: PyPayload + core::fmt::Debug> PyInner<T> {
449447 let member_count = typ. slots . member_count ;
450448 Box :: new ( Self {
451449 ref_count : RefCount :: new ( ) ,
452- typeid : T :: payload_type_id ( ) ,
453450 vtable : PyObjVTable :: of :: < T > ( ) ,
454451 typ : PyAtomicRef :: from ( typ) ,
455452 dict : dict. map ( InstanceDict :: new) ,
@@ -639,7 +636,7 @@ impl PyObject {
639636 #[ deprecated( note = "use downcastable instead" ) ]
640637 #[ inline( always) ]
641638 pub fn payload_is < T : PyPayload > ( & self ) -> bool {
642- self . 0 . typeid == T :: payload_type_id ( )
639+ self . 0 . vtable . typeid == T :: PAYLOAD_TYPE_ID
643640 }
644641
645642 /// Force to return payload as T.
@@ -722,7 +719,7 @@ impl PyObject {
722719
723720 #[ inline]
724721 pub ( crate ) fn typeid ( & self ) -> TypeId {
725- self . 0 . typeid
722+ self . 0 . vtable . typeid
726723 }
727724
728725 /// Check if this object can be downcast to T.
@@ -1276,7 +1273,6 @@ pub(crate) fn init_type_hierarchy() -> (PyTypeRef, PyTypeRef, PyTypeRef) {
12761273 let type_type_ptr = Box :: into_raw ( Box :: new ( partially_init ! (
12771274 PyInner :: <PyType > {
12781275 ref_count: RefCount :: new( ) ,
1279- typeid: TypeId :: of:: <PyType >( ) ,
12801276 vtable: PyObjVTable :: of:: <PyType >( ) ,
12811277 dict: None ,
12821278 weak_list: WeakRefList :: new( ) ,
@@ -1288,7 +1284,6 @@ pub(crate) fn init_type_hierarchy() -> (PyTypeRef, PyTypeRef, PyTypeRef) {
12881284 let object_type_ptr = Box :: into_raw ( Box :: new ( partially_init ! (
12891285 PyInner :: <PyType > {
12901286 ref_count: RefCount :: new( ) ,
1291- typeid: TypeId :: of:: <PyType >( ) ,
12921287 vtable: PyObjVTable :: of:: <PyType >( ) ,
12931288 dict: None ,
12941289 weak_list: WeakRefList :: new( ) ,
0 commit comments