From b0fd51f5deb5bc1c6cea9b485ac4f92b2c475390 Mon Sep 17 00:00:00 2001 From: Chris Moradi <37349208+chrismoradi@users.noreply.github.com> Date: Mon, 15 Nov 2021 10:09:45 -0800 Subject: [PATCH] address PR feedback --- vm/src/builtins/object.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vm/src/builtins/object.rs b/vm/src/builtins/object.rs index 127351cba..871a0b935 100644 --- a/vm/src/builtins/object.rs +++ b/vm/src/builtins/object.rs @@ -5,7 +5,6 @@ use crate::{ PyArithmeticValue, PyAttributes, PyClassImpl, PyComparisonValue, PyContext, PyGenericObject, PyObject, PyObjectRef, PyResult, PyValue, TypeProtocol, VirtualMachine, }; -use num_bigint::BigInt; /// object() /// -- @@ -38,10 +37,8 @@ impl PyBaseObject { // Ensure that all abstract methods are implemented before instantiating instance. if let Some(abs_methods) = cls.get_attr("__abstractmethods__") { - if let Some(iter) = vm.get_method(abs_methods, "__len__") { - let values = vm.invoke(&iter?, ())?; - let unimplemented_abstract_method_count = super::int::get_value(&values); - if unimplemented_abstract_method_count > &BigInt::from(0) { + if let Some(unimplemented_abstract_method_count) = vm.obj_len_opt(&abs_methods) { + if unimplemented_abstract_method_count? > 0 { return Err( vm.new_type_error("You must implement the abstract methods".to_owned()) );