Пример #1
0
 def setdict(self, space, w_dict):
     # if somebody asked for the __dict__, and it did not devolve, it
     # needs to stay valid even if we set a new __dict__ on this object
     if self.w__dict__ is not None and self._inlined_dict_valid():
         make_rdict(self)
     self._clear_fields() # invalidate attributes on self
     self.w__dict__ = check_new_dictionary(space, w_dict)
Пример #2
0
 def setdict(self, space, w_dict):
     # if somebody asked for the __dict__, and it did not devolve, it
     # needs to stay valid even if we set a new __dict__ on this object
     if self.w__dict__ is not None and self._inlined_dict_valid():
         make_rdict(self)
     self._clear_fields()  # invalidate attributes on self
     self.w__dict__ = check_new_dictionary(space, w_dict)
Пример #3
0
 def setdict(self, space, w_dict):
     from pypy.interpreter.typedef import check_new_dictionary
     w_dict = check_new_dictionary(space, w_dict)
     w_olddict = self.getdict(space)
     assert isinstance(w_dict, W_DictMultiObject)
     if type(w_olddict.strategy) is not ObjectDictStrategy:
         w_olddict.strategy.switch_to_object_strategy(w_olddict)
     flag = self._get_mapdict_map().write(self, ("dict", SPECIAL), w_dict)
     assert flag
Пример #4
0
 def setdict(self, space, w_dict):
     from pypy.interpreter.typedef import check_new_dictionary
     w_dict = check_new_dictionary(space, w_dict)
     w_olddict = self.getdict(space)
     assert isinstance(w_dict, W_DictMultiObject)
     if type(w_olddict.strategy) is not ObjectDictStrategy:
         w_olddict.strategy.switch_to_object_strategy(w_olddict)
     flag = self._get_mapdict_map().write(self, ("dict", SPECIAL), w_dict)
     assert flag
Пример #5
0
 def setdict(self, space, w_dict):
     from pypy.interpreter.typedef import check_new_dictionary
     w_dict = check_new_dictionary(space, w_dict)
     w_olddict = self.getdict(space)
     assert isinstance(w_dict, W_DictMultiObject)
     # The old dict has got 'self' as dstorage, but we are about to
     # change self's ("dict", SPECIAL) attribute to point to the
     # new dict.  If the old dict was using the MapDictStrategy, we
     # have to force it now: otherwise it would remain an empty
     # shell that continues to delegate to 'self'.
     if type(w_olddict.get_strategy()) is MapDictStrategy:
         w_olddict.get_strategy().switch_to_object_strategy(w_olddict)
     flag = self._get_mapdict_map().write(self, "dict", SPECIAL, w_dict)
     assert flag
Пример #6
0
 def setdict(self, space, w_dict):
     from pypy.interpreter.typedef import check_new_dictionary
     w_dict = check_new_dictionary(space, w_dict)
     w_olddict = self.getdict(space)
     assert isinstance(w_dict, W_DictMultiObject)
     # The old dict has got 'self' as dstorage, but we are about to
     # change self's ("dict", SPECIAL) attribute to point to the
     # new dict.  If the old dict was using the MapDictStrategy, we
     # have to force it now: otherwise it would remain an empty
     # shell that continues to delegate to 'self'.
     if type(w_olddict.get_strategy()) is MapDictStrategy:
         w_olddict.get_strategy().switch_to_object_strategy(w_olddict)
     flag = self._get_mapdict_map().write(self, "dict", SPECIAL, w_dict)
     assert flag