Skip to content

Commit 4c9fa5a

Browse files
committed
add_slot_wrappers must be called up to once
1 parent 9d99ea9 commit 4c9fa5a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

vm/src/pyobject.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,9 @@ impl PyContext {
389389
}
390390

391391
pub fn add_slot_wrappers(&self, ty: &PyTypeRef) {
392-
if !ty.attributes.read().contains_key("__new__") {
393-
let new_wrapper =
394-
self.new_bound_method(self.tp_new_wrapper.clone(), ty.clone().into_object());
395-
ty.set_str_attr("__new__", new_wrapper);
396-
}
392+
let new_wrapper =
393+
self.new_bound_method(self.tp_new_wrapper.clone(), ty.clone().into_object());
394+
ty.set_str_attr("__new__", new_wrapper);
397395
}
398396

399397
pub fn is_tp_new_wrapper(&self, obj: &PyObjectRef) -> bool {

0 commit comments

Comments
 (0)