[pypy-svn] pypy default: one more test

antocuni commits-noreply at bitbucket.org
Wed Mar 16 18:06:33 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r42717:f11fa89afaaa
Date: 2011-03-16 14:39 +0100
http://bitbucket.org/pypy/pypy/changeset/f11fa89afaaa/

Log:	one more test

diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -654,7 +654,7 @@
         log = self.run(main, [500], threshold=400)
         assert log.result == 500
         loop, = log.loops_by_id('call')
-        loop.match_by_id('call', opcode='CALL_FUNCTION', expected_src="""
+        assert loop.match_by_id('call', opcode='CALL_FUNCTION', expected_src="""
             # make sure that the "block" is not allocated
             ...
             i20 = force_token()
@@ -671,3 +671,28 @@
             p32 = call_may_force(11376960, p18, p22, descr=<GcPtrCallDescr>)
             ...
         """)
+
+    def test_import_in_function(self):
+        def main(n):
+            i = 0
+            while i < n:
+                from sys import version  # ID: import
+                i += 1
+            return i
+        #
+        log = self.run(main, [500], threshold=400)
+        assert log.result == 500
+        loop, = log.loops_by_id('import')
+        assert loop.match_by_id('import', """
+            p14 = call(ConstClass(ll_split_chr__GcStruct_listLlT_rpy_stringPtr_Char), p8, 46, descr=<GcPtrCallDescr>)
+            guard_no_exception(descr=<Guard4>)
+            guard_nonnull(p14, descr=<Guard5>)
+            i15 = getfield_gc(p14, descr=<SignedFieldDescr list.length .*>)
+            i16 = int_is_true(i15)
+            guard_true(i16, descr=<Guard6>)
+            p18 = call(ConstClass(ll_pop_default__dum_nocheckConst_listPtr), p14, descr=<GcPtrCallDescr>)
+            guard_no_exception(descr=<Guard7>)
+            i19 = getfield_gc(p14, descr=<SignedFieldDescr list.length .*>)
+            i20 = int_is_true(i19)
+            guard_false(i20, descr=<Guard8>)
+        """)


More information about the Pypy-commit mailing list