diff --git a/vm/src/obj/objfunction.rs b/vm/src/obj/objfunction.rs index d1e1cb3f98..0496d897aa 100644 --- a/vm/src/obj/objfunction.rs +++ b/vm/src/obj/objfunction.rs @@ -64,24 +64,11 @@ pub struct PyMethod { // TODO: these shouldn't be public pub object: PyObjectRef, pub function: PyObjectRef, - pub actually_bind: bool, } impl PyMethod { pub fn new(object: PyObjectRef, function: PyObjectRef) -> Self { - PyMethod { - object, - function, - actually_bind: true, - } - } - - pub fn new_nobind(object: PyObjectRef, function: PyObjectRef) -> Self { - PyMethod { - object, - function, - actually_bind: false, - } + PyMethod { object, function } } fn getattribute(&self, name: PyStringRef, vm: &VirtualMachine) -> PyResult { diff --git a/vm/src/vm.rs b/vm/src/vm.rs index d82f224fd5..8c67089441 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -664,14 +664,9 @@ impl VirtualMachine { } else if let Some(PyMethod { ref function, ref object, - actually_bind, }) = func_ref.payload() { - let args = if *actually_bind { - args.insert(object.clone()) - } else { - args - }; + let args = args.insert(object.clone()); self.invoke(&function, args) } else if let Some(builtin_func) = func_ref.payload::() { builtin_func.as_func()(self, args) @@ -1450,16 +1445,6 @@ impl VirtualMachine { attr_value: impl Into, ) -> PyResult<()> { let val = attr_value.into(); - let val = if val - .class() - .is(&self.ctx.types.builtin_function_or_method_type) - { - PyMethod::new_nobind(module.clone(), val) - .into_ref(self) - .into_object() - } else { - val - }; self.set_attr(module, attr_name, val)?; Ok(()) }