File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,24 +64,11 @@ pub struct PyMethod {
6464 // TODO: these shouldn't be public
6565 pub object : PyObjectRef ,
6666 pub function : PyObjectRef ,
67- pub actually_bind : bool ,
6867}
6968
7069impl PyMethod {
7170 pub fn new ( object : PyObjectRef , function : PyObjectRef ) -> Self {
72- PyMethod {
73- object,
74- function,
75- actually_bind : true ,
76- }
77- }
78-
79- pub fn new_nobind ( object : PyObjectRef , function : PyObjectRef ) -> Self {
80- PyMethod {
81- object,
82- function,
83- actually_bind : false ,
84- }
71+ PyMethod { object, function }
8572 }
8673
8774 fn getattribute ( & self , name : PyStringRef , vm : & VirtualMachine ) -> PyResult {
Original file line number Diff line number Diff line change @@ -664,14 +664,9 @@ impl VirtualMachine {
664664 } else if let Some ( PyMethod {
665665 ref function,
666666 ref object,
667- actually_bind,
668667 } ) = func_ref. payload ( )
669668 {
670- let args = if * actually_bind {
671- args. insert ( object. clone ( ) )
672- } else {
673- args
674- } ;
669+ let args = args. insert ( object. clone ( ) ) ;
675670 self . invoke ( & function, args)
676671 } else if let Some ( builtin_func) = func_ref. payload :: < PyBuiltinFunction > ( ) {
677672 builtin_func. as_func ( ) ( self , args)
@@ -1450,16 +1445,6 @@ impl VirtualMachine {
14501445 attr_value : impl Into < PyObjectRef > ,
14511446 ) -> PyResult < ( ) > {
14521447 let val = attr_value. into ( ) ;
1453- let val = if val
1454- . class ( )
1455- . is ( & self . ctx . types . builtin_function_or_method_type )
1456- {
1457- PyMethod :: new_nobind ( module. clone ( ) , val)
1458- . into_ref ( self )
1459- . into_object ( )
1460- } else {
1461- val
1462- } ;
14631448 self . set_attr ( module, attr_name, val) ?;
14641449 Ok ( ( ) )
14651450 }
You can’t perform that action at this time.
0 commit comments