Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_mutate_class

self = <pypy.module.pypyjit.test_pypy_c.test_instance.TestInstance object at 0x0000000010d90918>

    def test_mutate_class(self):
        def fn(n):
            class LL(object):
                def __init__(self, n):
                    self.n = n
            class A(object):
                count = None
                def __init__(self, a):
                    self.a = a
                def f(self):
                    return self.count
            i = 0
            a = A(1)
            while i < n:
                A.count = LL(A.count) # ID: mutate
                a.f()    # ID: meth1
                i += 1
            return i
        #
        log = self.run(fn, [1000], threshold=10)
        assert log.result == 1000
        #
        # first, we test the entry bridge
        # -------------------------------
        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',
                                    'getfield_gc_r', 'guard_nonnull_class',
>                                   'getfield_gc_r', 'guard_value', # type check on the attribute
                                    ]
E       assert ['getfield_gc...'guard_value'] == ['guard_value'...'guard_value']
E         At index 0 diff: 'getfield_gc_r' != 'guard_value'
E         Right contains more items, first extra item: 'getfield_gc_r'
E         Use -v to get the full diff

pypy/module/pypyjit/test_pypy_c/test_instance.py:162: AssertionError
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_mutate_class