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.

Comments (0)

Files changed (3)

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]

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:

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.