[pypy-commit] pypy default: Move the gettopframe_nohidden() out of the way: if we call

arigo noreply at buildbot.pypy.org
Sun Oct 16 23:08:54 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r48095:0a33c12bc697
Date: 2011-10-16 23:02 +0200
http://bitbucket.org/pypy/pypy/changeset/0a33c12bc697/

Log:	Move the gettopframe_nohidden() out of the way: if we call
	eval(a,glob,loc) with a 'glob' specified, then we don't need it.
	Helps the JIT in this case.

diff --git a/pypy/module/__builtin__/compiling.py b/pypy/module/__builtin__/compiling.py
--- a/pypy/module/__builtin__/compiling.py
+++ b/pypy/module/__builtin__/compiling.py
@@ -84,8 +84,8 @@
         raise OperationError(space.w_TypeError,
               w('eval() arg 1 must be a string or code object'))
 
-    caller = space.getexecutioncontext().gettopframe_nohidden()
     if space.is_w(w_globals, space.w_None):
+        caller = space.getexecutioncontext().gettopframe_nohidden()
         if caller is None:
             w_globals = space.newdict()
             if space.is_w(w_locals, space.w_None):
@@ -97,13 +97,6 @@
     elif space.is_w(w_locals, space.w_None):
         w_locals = w_globals
 
-    try:
-        space.getitem(w_globals, space.wrap('__builtins__'))
-    except OperationError, e:
-        if not e.match(space, space.w_KeyError):
-            raise
-        if caller is not None:
-            w_builtin = space.builtin.pick_builtin(caller.w_globals)
-            space.setitem(w_globals, space.wrap('__builtins__'), w_builtin)
+    space.builtin.pick_builtin(w_globals)
 
     return codeobj.exec_code(space, w_globals, w_locals)


More information about the pypy-commit mailing list