Author: Alex Gaynor <[email protected]>
Branch: jit-settrace
Changeset: r67584:849ecbc3d133
Date: 2013-10-24 13:57 -0700
http://bitbucket.org/pypy/pypy/changeset/849ecbc3d133/

Log:    Added a test

diff --git a/pypy/module/pypyjit/test_pypy_c/test_min_max.py 
b/pypy/module/pypyjit/test_pypy_c/test_min_max.py
--- a/pypy/module/pypyjit/test_pypy_c/test_min_max.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_min_max.py
@@ -1,8 +1,7 @@
-import py
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
+
 class TestMinMax(BaseTestPyPyC):
-
     def test_min_max(self):
         def main():
             i=0
@@ -24,7 +23,6 @@
             --TICK--
             jump(..., descr=...)
         """)
-        
 
     def test_silly_max(self):
         def main():
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py 
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -408,3 +408,20 @@
         log = self.run(main, [300])
         loop, = log.loops_by_id("long_op")
         assert len(loop.ops_by_id("long_op")) == 0
+
+    def test_settrace(self):
+        def main(n):
+            import sys
+            sys.settrace(lambda *args, **kwargs: None)
+
+            def f():
+                return 1
+
+            while n:
+                n -= f()
+
+        log = self.run(main, [300])
+        loops = log.loops_by_filename(self.filepath)
+        # the following assertion fails if the loop was cancelled due
+        # to "abort: vable escape"
+        assert len(loops) == 1
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to