def setitem_str(self, w_dict, key, w_value): cell = self.getdictvalue_no_unwrapping(w_dict, key) w_value = write_cell(self.space, cell, w_value) if w_value is None: return self.mutated() self.unerase(w_dict.dstorage)[key] = w_value
def STORE_GLOBAL_cached(self, nameindex, next_instr): w_newvalue = self.popvalue() if jit.we_are_jitted() or self.getdebug() is not None: varname = self.getname_u(nameindex) self.space.setitem_str(self.get_w_globals(), varname, w_newvalue) return pycode = self.pycode cache_wref = pycode._globals_caches[nameindex] if cache_wref is not None: cache = cache_wref() if cache and cache.valid: w_value = write_cell(self.space, cache.cell, w_newvalue) if w_value is None: return varname = self.getname_u(nameindex) w_globals = self.pycode.w_globals self.space.setitem_str(w_globals, varname, w_newvalue) if isinstance(w_globals, W_ModuleDictObject): # the following can never be true, becaus W_ModuleDictObject can't be # user-subclassed, but let's be safe assert not w_globals.user_overridden_class cache = w_globals.get_global_cache(varname) if cache is not None: assert cache.valid and cache.ref is not None pycode._globals_caches[nameindex] = cache.ref
def _setitem_str_cell_known(self, cell, w_dict, key, w_value): w_value = write_cell(self.space, cell, w_value) if w_value is None: return self.mutated() self.unerase(w_dict.dstorage)[key] = w_value if self.caches is None: return cache = self.caches.get(key, None) if cache: cache.cell = w_value
def _setitem_str_cell_known(self, cell, w_dict, key, w_value): w_value = write_cell(self.space, cell, w_value) if w_value is None: return self.mutated() self.unerase(w_dict.dstorage)[key] = w_value