Commits

Ronan Lamy  committed 0a90d88

Kill FlowEC.w_globals

FlowExecutionContext doesn't really need this attribute, but the frame does,
so store it there only.

  • Participants
  • Parent commits 459fc98
  • Branches translation-cleanup

Comments (0)

Files changed (3)

File pypy/objspace/flow/flowcontext.py

         self.is_generator = bool(code.co_flags & CO_GENERATOR)
         self.code = code
 
-        self.w_globals = space.wrap(func.func_globals)
-
         self.crnt_offset = -1
         self.frame = frame = FlowSpaceFrame(self.space, code,
-                               self.w_globals, func, constargs)
+                               func, constargs)
         self.joinpoints = {}
         initialblock = SpamBlock(frame.getstate())
         self.pendingblocks = collections.deque([initialblock])
 
 class FlowSpaceFrame(pyframe.CPythonFrame):
 
-    def __init__(self, space, code, w_globals, func, constargs=None):
+    def __init__(self, space, code, func, constargs=None):
+        w_globals = Constant(func.func_globals)
         class outerfunc: pass # hack
         if func.func_closure is not None:
             cl = [c.cell_contents for c in func.func_closure]

File pypy/objspace/flow/objspace.py

     def setitem(self, w_obj, w_key, w_val):
         # protect us from globals write access
         ec = self.getexecutioncontext()
-        if ec and w_obj is ec.w_globals:
+        if ec and w_obj is ec.frame.w_globals:
             raise SyntaxError("attempt to modify global attribute %r in %r"
                             % (w_key, ec.graph.func))
         if self.concrete_mode:

File pypy/objspace/flow/test/test_framestate.py

             pass
         code = func.func_code
         code = PyCode._from_code(self.space, code)
-        w_globals = Constant({}) # space.newdict()
-        frame = FlowSpaceFrame(space, code, w_globals, func)
+        frame = FlowSpaceFrame(space, code, func)
         # hack the frame
         frame.locals_stack_w[frame.pycode.co_nlocals-1] = Constant(None)
         return frame