Commits

Amaury Forgeot d'Arc committed 93ae975

getdict() now takes the 'space' as argument

Comments (0)

Files changed (7)

pypy/interpreter/baseobjspace.py

     _settled_ = True
     user_overridden_class = False
 
-    def getdict(self):
+    def getdict(self, space):
         return None
 
     def getdictvalue(self, space, attr):
-        w_dict = self.getdict()
+        w_dict = self.getdict(space)
         if w_dict is not None:
             return space.finditem_str(w_dict, attr)
         return None
 
     def setdictvalue(self, space, attr, w_value):
-        w_dict = self.getdict()
+        w_dict = self.getdict(space)
         if w_dict is not None:
             space.setitem_str(w_dict, attr, w_value)
             return True
         return False
 
     def deldictvalue(self, space, w_name):
-        w_dict = self.getdict()
+        w_dict = self.getdict(space)
         if w_dict is not None:
             try:
                 space.delitem(w_dict, w_name)
 
     def export_builtin_exceptions(self):
         """NOT_RPYTHON"""
-        w_dic = self.exceptions_module.getdict()
+        w_dic = self.exceptions_module.getdict(self)
         w_keys = self.call_method(w_dic, "keys")
         exc_types_w = {}
         for w_name in self.unpackiterable(w_keys):

pypy/interpreter/function.py

             i += 1
         return new_frame.run()
 
-    def getdict(self):
+    def getdict(self, space):
         if self.w_func_dict is None:
-            self.w_func_dict = self.space.newdict(instance=True)
+            self.w_func_dict = space.newdict(instance=True)
         return self.w_func_dict
 
     def setdict(self, space, w_dict):

pypy/interpreter/interactive.py

         import keyword
         w_res = self.space.call_method(self.w_globals, "keys")
         namespace_keys = self.space.unwrap(w_res)
-        w_res = self.space.call_method(self.space.builtin.getdict(), "keys")
+        w_res = self.space.call_method(self.space.builtin.getdict(self.space),
+                                       "keys")
         builtin_keys = self.space.unwrap(w_res)
 
         matches = []

pypy/interpreter/mixedmodule.py

             return w_value
 
 
-    def getdict(self):
+    def getdict(self, space):
         if self.lazy:
-            space = self.space
             for name in self.loaders:
                 w_value = self.get(name)
                 space.setitem(self.w_dict, space.new_interned_str(name), w_value)
         return self.w_dict
 
     def _freeze_(self):
-        self.getdict()
+        self.getdict(self.space)
         self.w_initialdict = None
         self.startup_called = False
         self._frozen = True

pypy/interpreter/module.py

         sys.exitfunc(), if the module has been imported.
         """
 
-    def getdict(self):
+    def getdict(self, space):
         return self.w_dict
 
     def descr_module__new__(space, w_subtype, __args__):
             w_mod    = space.getbuiltinmodule('_pickle_support')
             mod      = space.interp_w(MixedModule, w_mod)
             new_inst = mod.get('module_new')
-            return space.newtuple([new_inst, space.newtuple([w_name,
-                                    self.getdict()]),
+            return space.newtuple([new_inst,
+                                   space.newtuple([w_name,
+                                                   self.getdict(space)]),
                                   ])
         #already imported case
         w_import = space.builtin.get('__import__')

pypy/interpreter/pyframe.py

         return pytraceback.offset2lineno(self.pycode, self.last_instr)
 
     def fget_f_builtins(self, space):
-        return self.get_builtin().getdict()
+        return self.get_builtin().getdict(space)
 
     def fget_f_back(self, space):
         return self.space.wrap(self.f_backref())

pypy/interpreter/typedef.py

         if "user_setup" in body:
             base_user_setup = body["user_setup"]
         class Proto(object):
-            def getdict(self):
+            def getdict(self, space):
                 return self.w__dict__
             
             def setdict(self, space, w_dict):
 from pypy.interpreter.special import NotImplemented, Ellipsis
 
 def descr_get_dict(space, w_obj):
-    w_dict = w_obj.getdict()
+    w_dict = w_obj.getdict(space)
     if w_dict is None:
         typename = space.type(w_obj).getname(space)
         raise operationerrfmt(space.w_TypeError,