From 4c9fa5a5212777f745d7f622a8255e70d07f264d Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sat, 14 Aug 2021 17:56:17 +0900 Subject: [PATCH] add_slot_wrappers must be called up to once --- vm/src/pyobject.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index dae5a3e60..e405c5141 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -389,11 +389,9 @@ impl PyContext { } pub fn add_slot_wrappers(&self, ty: &PyTypeRef) { - if !ty.attributes.read().contains_key("__new__") { - let new_wrapper = - self.new_bound_method(self.tp_new_wrapper.clone(), ty.clone().into_object()); - ty.set_str_attr("__new__", new_wrapper); - } + let new_wrapper = + self.new_bound_method(self.tp_new_wrapper.clone(), ty.clone().into_object()); + ty.set_str_attr("__new__", new_wrapper); } pub fn is_tp_new_wrapper(&self, obj: &PyObjectRef) -> bool {