Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r45252:a36842c12c80 Date: 2011-07-01 23:36 +0200 http://bitbucket.org/pypy/pypy/changeset/a36842c12c80/
Log: a test that checks that mutating a string dict does not change any caches diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py b/pypy/module/pypyjit/test_pypy_c/test_containers.py new file mode 100644 --- /dev/null +++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py @@ -0,0 +1,25 @@ + +import py, sys +from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC + + +class TestDicts(BaseTestPyPyC): + def test_strdict(self): + def fn(n): + import sys + d = {} + class A(object): + pass + a = A() + a.x = 1 + for s in sys.modules.keys() * 1000: + inc = a.x # ID: look + d[s] = d.get(s, 0) + inc + return sum(d.values()) + # + log = self.run(fn, [1000]) + assert log.result % 1000 == 0 + loop, = log.loops_by_filename(self.filepath) + ops = loop.ops_by_id('look') + assert log.opnames(ops) == ['setfield_gc', + 'guard_not_invalidated'] _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit