File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -655,7 +655,7 @@ impl PyObject {
655
655
656
656
#[ inline( always) ]
657
657
pub fn payload_is < T : PyObjectPayload > ( & self ) -> bool {
658
- self . 0 . typeid == TypeId :: of :: < T > ( )
658
+ self . 0 . typeid == T :: payload_type_id ( )
659
659
}
660
660
661
661
/// Force to return payload as T.
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ cfg_if::cfg_if! {
19
19
pub trait PyPayload :
20
20
std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + Sized + ' static
21
21
{
22
+ #[ inline]
23
+ fn payload_type_id ( ) -> std:: any:: TypeId {
24
+ std:: any:: TypeId :: of :: < Self > ( )
25
+ }
22
26
fn class ( ctx : & Context ) -> & ' static Py < PyType > ;
23
27
24
28
#[ inline]
@@ -75,7 +79,7 @@ pub trait PyPayload:
75
79
}
76
80
77
81
pub trait PyObjectPayload :
78
- std:: any:: Any + std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + ' static
82
+ PyPayload + std:: any:: Any + std:: fmt:: Debug + MaybeTraverse + PyThreadingConstraint + ' static
79
83
{
80
84
}
81
85
You can’t perform that action at this time.
0 commit comments