1- use super :: { PyBoundMethod , PyStr , PyType , PyTypeRef } ;
1+ use super :: { PyStr , PyType , PyTypeRef } ;
22use crate :: {
33 builtins:: builtinfunc:: PyBuiltinMethod ,
44 class:: PyClassImpl ,
55 common:: lock:: PyMutex ,
66 function:: { FuncArgs , IntoPyNativeFunc } ,
77 types:: { Callable , Constructor , GetDescriptor , Initializer } ,
8- AsObject , Context , Py , PyObjectRef , PyPayload , PyRef , PyResult , VirtualMachine ,
8+ Context , Py , PyObjectRef , PyPayload , PyRef , PyResult , VirtualMachine ,
99} ;
1010
1111#[ pyclass( module = false , name = "staticmethod" ) ]
@@ -24,16 +24,12 @@ impl GetDescriptor for PyStaticMethod {
2424 fn descr_get (
2525 zelf : PyObjectRef ,
2626 obj : Option < PyObjectRef > ,
27- cls : Option < PyObjectRef > ,
27+ _cls : Option < PyObjectRef > ,
2828 vm : & VirtualMachine ,
2929 ) -> PyResult {
3030 let ( zelf, _obj) = Self :: _unwrap ( zelf, obj, vm) ?;
31- let cls = cls. unwrap_or_else ( || _obj. class ( ) . clone ( ) . into ( ) ) ;
32- let call_descr_get: PyResult < PyObjectRef > = zelf. callable . lock ( ) . get_attr ( "__get__" , vm) ;
33- match call_descr_get {
34- Err ( _) => Ok ( PyBoundMethod :: new_ref ( cls, zelf. callable . lock ( ) . clone ( ) , & vm. ctx ) . into ( ) ) ,
35- Ok ( call_descr_get) => vm. invoke ( & call_descr_get, ( cls. clone ( ) , cls) ) ,
36- }
31+ let x = Ok ( zelf. callable . lock ( ) . clone ( ) ) ;
32+ x
3733 }
3834}
3935
@@ -107,7 +103,10 @@ impl Initializer for PyStaticMethod {
107103 }
108104}
109105
110- #[ pyclass( with( Callable , Constructor , Initializer ) , flags( BASETYPE , HAS_DICT ) ) ]
106+ #[ pyclass(
107+ with( Callable , GetDescriptor , Constructor , Initializer ) ,
108+ flags( BASETYPE , HAS_DICT )
109+ ) ]
111110impl PyStaticMethod {
112111 #[ pyproperty( magic) ]
113112 fn func ( & self ) -> PyObjectRef {
0 commit comments