[pypy-commit] pypy lazy-fast2locals: a test that checks that w_locals is not there
cfbolz
noreply at buildbot.pypy.org
Fri Oct 23 13:06:41 EDT 2015
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: lazy-fast2locals
Changeset: r80413:561181018410
Date: 2015-10-23 19:05 +0200
http://bitbucket.org/pypy/pypy/changeset/561181018410/
Log: a test that checks that w_locals is not there
diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -1,10 +1,14 @@
from rpython.tool import udir
from pypy.conftest import option
+from pypy.interpreter.gateway import interp2app
+def check_no_w_locals(space, w_frame):
+ return space.wrap(w_frame.getorcreatedebug().w_locals is None)
class AppTestPyFrame:
def setup_class(cls):
+ space = cls.space
cls.w_udir = cls.space.wrap(str(udir.udir))
cls.w_tempfile1 = cls.space.wrap(str(udir.udir.join('tempfile1')))
if not option.runappdirect:
@@ -17,6 +21,8 @@
w_call_further.code.hidden_applevel = True # hack
cls.w_call_further = w_call_further
+ cls.w_check_no_w_locals = space.wrap(interp2app(check_no_w_locals))
+
# test for the presence of the attributes, not functionality
def test_f_locals(self):
@@ -493,6 +499,25 @@
sys.settrace(None)
assert res == 42
+ def test_fast2locals_called_lazily(self):
+ import sys
+ class FrameHolder:
+ pass
+ fh = FrameHolder()
+ def trace(frame, what, arg):
+ # trivial trace function, does not access f_locals
+ fh.frame = frame
+ return trace
+ def f(x):
+ x += 1
+ return x
+ sys.settrace(trace)
+ res = f(1)
+ sys.settrace(None)
+ assert res == 2
+ if hasattr(self, "check_no_w_locals"): # not appdirect
+ assert self.check_no_w_locals(fh.frame)
+
def test_set_unset_f_trace(self):
import sys
seen = []
More information about the pypy-commit
mailing list