File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,15 @@ impl PyBuiltinMethod {
254254 self . class. name( )
255255 )
256256 }
257+ #[ pymethod( magic) ]
258+ fn reduce (
259+ & self ,
260+ vm : & VirtualMachine ,
261+ ) -> ( Option < PyObjectRef > , ( Option < PyObjectRef > , PyStrRef ) ) {
262+ let builtinfunc_getattr = vm. builtins . get_attr ( "getattr" , vm) . ok ( ) ;
263+ let classname = vm. builtins . get_attr ( self . class . name ( ) . to_string ( ) , vm) . ok ( ) ;
264+ ( builtinfunc_getattr, ( classname, self . value . name . clone ( ) ) )
265+ }
257266}
258267impl Unconstructible for PyBuiltinMethod { }
259268
Original file line number Diff line number Diff line change @@ -552,6 +552,17 @@ impl PyBoundMethod {
552552 ) )
553553 }
554554
555+ #[ pymethod( magic) ]
556+ fn reduce (
557+ & self ,
558+ vm : & VirtualMachine ,
559+ ) -> ( Option < PyObjectRef > , ( PyObjectRef , Option < PyObjectRef > ) ) {
560+ let builtinfunc_getattr = vm. builtins . get_attr ( "getattr" , vm) . ok ( ) ;
561+ let funcself = self . object . clone ( ) ;
562+ let funcname = self . function . get_attr ( "__name__" , vm) . ok ( ) ;
563+ ( builtinfunc_getattr, ( funcself, funcname) )
564+ }
565+
555566 #[ pygetset( magic) ]
556567 fn doc ( & self , vm : & VirtualMachine ) -> PyResult {
557568 self . function . get_attr ( "__doc__" , vm)
You can’t perform that action at this time.
0 commit comments