mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
Merge pull request #2884 from youknowone/slot-wrapper
add_slot_wrappers must be called up to once
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user