[pypy-commit] pypy py3.5: Fix two tests, remove two other old-style class tests

arigo pypy.commits at gmail.com
Tue Jan 3 12:16:49 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89342:e3a207b54c14
Date: 2017-01-03 18:16 +0100
http://bitbucket.org/pypy/pypy/changeset/e3a207b54c14/

Log:	Fix two tests, remove two other old-style class tests

diff --git a/pypy/module/pypyjit/test_pypy_c/test_instance.py b/pypy/module/pypyjit/test_pypy_c/test_instance.py
--- a/pypy/module/pypyjit/test_pypy_c/test_instance.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_instance.py
@@ -105,7 +105,11 @@
         # -------------------------------
         entry_bridge, = log.loops_by_filename(self.filepath, is_entry_bridge=True)
         ops = entry_bridge.ops_by_id('mutate', opcode='LOAD_ATTR')
-        assert log.opnames(ops) == ['guard_value', 'guard_not_invalidated',
+        # in PyPy3 we get a dummy getfield_gc_r (*) for
+        # W_UnicodeObject._utf8, which is usually removed by the backend
+        assert log.opnames(ops) == ['guard_value',
+                                    'getfield_gc_r',  # <= (*)
+                                    'guard_not_invalidated',
                                     'getfield_gc_i']
         # the STORE_ATTR is folded away
         assert list(entry_bridge.ops_by_id('meth1', opcode='STORE_ATTR')) == []
@@ -153,7 +157,11 @@
         # -------------------------------
         entry_bridge, = log.loops_by_filename(self.filepath, is_entry_bridge=True)
         ops = entry_bridge.ops_by_id('mutate', opcode='LOAD_ATTR')
-        assert log.opnames(ops) == ['guard_value', 'guard_not_invalidated',
+        # in PyPy3 we get a dummy getfield_gc_r (*) for
+        # W_UnicodeObject._utf8, which is usually removed by the backend
+        assert log.opnames(ops) == ['guard_value',
+                                    'getfield_gc_r',   # <= (*)
+                                    'guard_not_invalidated',
                                     'getfield_gc_r', 'guard_nonnull_class',
                                     'getfield_gc_r', 'guard_value', # type check on the attribute
                                     ]
@@ -187,76 +195,6 @@
 
         """)
 
-    def test_oldstyle_methcall(self):
-        def main():
-            def g(): pass
-            class A:
-                def f(self):
-                    return self.x + 1
-            class I(A):
-                pass
-            class J(I):
-                pass
-
-
-            class B(J):
-                def __init__(self, x):
-                    self.x = x
-
-            i = 0
-            b = B(1)
-            while i < 1000:
-                g()
-                v = b.f() # ID: meth
-                i += v
-            return i
-
-        log = self.run(main, [], threshold=80)
-        loop, = log.loops_by_filename(self.filepath, is_entry_bridge=True)
-        assert loop.match_by_id('meth',
-        '''
-    guard_nonnull_class(p18, ..., descr=...)
-    p52 = getfield_gc_r(p18, descr=...) # read map
-    guard_value(p52, ConstPtr(ptr53), descr=...)
-    p54 = getfield_gc_r(p18, descr=...) # read class
-    guard_value(p54, ConstPtr(ptr55), descr=...)
-    p56 = force_token() # done
-        ''')
-
-
-    def test_oldstyle_newstyle_mix(self):
-        def main():
-            class A:
-                pass
-
-            class B(object, A):
-                def __init__(self, x):
-                    self.x = x
-
-            i = 0
-            b = B(1)
-            while i < 100:
-                v = b.x # ID: loadattr1
-                v = b.x # ID: loadattr2
-                i += v
-            return i
-
-        log = self.run(main, [], threshold=80)
-        loop, = log.loops_by_filename(self.filepath)
-        assert loop.match_by_id('loadattr1',
-        '''
-        guard_not_invalidated(descr=...)
-        i19 = call_i(ConstClass(ll_call_lookup_function), _, _, _, 0, descr=...)
-        guard_no_exception(descr=...)
-        i22 = int_lt(i19, 0)
-        guard_true(i22, descr=...)
-        i26 = call_i(ConstClass(ll_call_lookup_function), _, _, _, 0, descr=...)
-        guard_no_exception(descr=...)
-        i29 = int_lt(i26, 0)
-        guard_true(i29, descr=...)
-        ''')
-        assert loop.match_by_id('loadattr2', "")   # completely folded away
-
     def test_python_contains(self):
         def main():
             class A(object):


More information about the pypy-commit mailing list