File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -655,7 +655,7 @@ impl PyObject {
655655
656656 #[ inline( always) ]
657657 pub fn payload_is < T : PyObjectPayload > ( & self ) -> bool {
658- self . 0 . typeid == TypeId :: of :: < T > ( )
658+ self . 0 . typeid == T :: payload_type_id ( )
659659 }
660660
661661 /// Force to return payload as T.
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ cfg_if::cfg_if! {
1919pub trait PyPayload :
2020 std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + Sized + ' static
2121{
22+ #[ inline]
23+ fn payload_type_id ( ) -> std:: any:: TypeId {
24+ std:: any:: TypeId :: of :: < Self > ( )
25+ }
2226 fn class ( ctx : & Context ) -> & ' static Py < PyType > ;
2327
2428 #[ inline]
@@ -75,7 +79,7 @@ pub trait PyPayload:
7579}
7680
7781pub trait PyObjectPayload :
78- std:: any:: Any + std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + ' static
82+ PyPayload + std:: any:: Any + std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + ' static
7983{
8084}
8185
You can’t perform that action at this time.
0 commit comments