[pypy-commit] pypy default: Wrote a new test for mix of old and new style classes. Note that this is
fijal
noreply at buildbot.pypy.org
Tue May 17 11:49:59 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r44231:4ba3c304d4bd
Date: 2011-05-17 11:57 +0200
http://bitbucket.org/pypy/pypy/changeset/4ba3c304d4bd/
Log: Wrote a new test for mix of old and new style classes. Note that
this is much worse than old-style classes alone (2 dict lookups),
but unsure if anything can be done short of enabling version tags on
such mixtures.
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
@@ -1676,3 +1676,36 @@
loop, = log.loops_by_filename(self.filepath)
import pdb;pdb.set_trace()
assert loop.match_by_id('div', "") # optimized away
+
+ 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: loadattr
+ i += v
+ return i
+
+ log = self.run(main, [], threshold=80)
+ loop, = log.loops_by_filename(self.filepath)
+ loop.match_by_id('loadattr',
+ '''
+ guard_not_invalidated(descr=...)
+ i19 = call(ConstClass(ll_dict_lookup), _, _, _, descr=...)
+ guard_no_exception(descr=...)
+ i21 = int_and(i19, _)
+ i22 = int_is_true(i21)
+ guard_true(i22, descr=...)
+ i26 = call(ConstClass(ll_dict_lookup), _, _, _, descr=...)
+ guard_no_exception(descr=...)
+ i28 = int_and(i26, _)
+ i29 = int_is_true(i28)
+ guard_true(i29, descr=...)
+ ''')
More information about the pypy-commit
mailing list