def become(self, w_other): # Force other to become a methoddict s_other = w_other.as_methoddict_get_shadow(self.space) # Do normal self ptr swap AbstractGenericShadow.become(self, w_other) # Swap class pointers self.s_class, s_other.s_class = s_other.s_class, self.s_class # Conditionally inform the class about the swap if self.s_class: self.s_class.store_s_methoddict(self) if s_other.s_class: s_other.s_class.store_s_methoddict(s_other)
def become(self, w_other): # Force other to become a methoddict s_other = w_other.as_methoddict_get_shadow(self.space) # Do normal self ptr swap AbstractGenericShadow.become(self, w_other) # Swap class pointers self.s_class, s_other.s_class = s_other.s_class, self.s_class # Conditionally inform the class about the swap if self.s_class: self.s_class.store_s_methoddict(self) if s_other.s_class: s_other.s_class.store_s_methoddict(s_other)