11use super :: { PyStr , PyStrInterned , PyType } ;
22use crate :: {
3- builtins:: { builtin_func:: PyNativeMethod , type_} ,
3+ builtins:: { builtin_func:: PyNativeMethod , type_, PyTypeRef } ,
44 class:: PyClassImpl ,
55 function:: { FuncArgs , PyMethodDef , PyMethodFlags , PySetterValue } ,
66 types:: { Callable , GetDescriptor , Representable , Unconstructible } ,
@@ -27,6 +27,7 @@ pub struct PyMethodDescriptor {
2727 pub common : PyDescriptor ,
2828 pub method : & ' static PyMethodDef ,
2929 // vectorcall: vectorcallfunc,
30+ pub objclass : & ' static Py < PyType > , // TODO: move to tp_members
3031}
3132
3233impl PyMethodDescriptor {
@@ -38,6 +39,7 @@ impl PyMethodDescriptor {
3839 qualname : PyRwLock :: new ( None ) ,
3940 } ,
4041 method,
42+ objclass : typ,
4143 }
4244 }
4345}
@@ -126,6 +128,10 @@ impl PyMethodDescriptor {
126128 . map ( |signature| signature. to_string ( ) )
127129 } )
128130 }
131+ #[ pygetset( magic) ]
132+ fn objclass ( & self ) -> PyTypeRef {
133+ self . objclass . to_owned ( )
134+ }
129135 #[ pymethod( magic) ]
130136 fn reduce (
131137 & self ,
0 commit comments