[pypy-svn] r39656 - pypy/dist/pypy/translator/c/test

mwh at codespeak.net mwh at codespeak.net
Fri Mar 2 12:01:24 CET 2007


Author: mwh
Date: Fri Mar  2 12:01:13 2007
New Revision: 39656

Modified:
   pypy/dist/pypy/translator/c/test/test_standalone.py
Log:
a standalone version of the horrible dictionary bug


Modified: pypy/dist/pypy/translator/c/test/test_standalone.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_standalone.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_standalone.py	Fri Mar  2 12:01:13 2007
@@ -118,3 +118,37 @@
     out = py.process.cmdexec("%s 500" % exe)
     assert int(out) == 500*501/2
     
+
+def test_dict_segfault():
+    py.test.skip('segfaults :(')
+    class Element:
+        pass
+
+    elements = [Element() for ii in range(10000)]
+
+    def dostuff():
+        reverse = {}
+        l = elements[:]
+
+        for ii in elements:
+            reverse[ii] = ii#Element()
+
+        for jj in range(100):
+            e = l[-1]
+            del reverse[e]
+            l.remove(e)
+
+    def f(args):
+        for ii in range(100):
+            dostuff()
+        return 0
+
+    t = TranslationContext()
+    t.config.translation.gc = 'framework'
+    t.buildannotator().build_types(f, [s_list_of_strings])
+    t.buildrtyper().specialize()
+
+    cbuilder = CStandaloneBuilder(t, f, t.config)
+    cbuilder.generate_source()
+    cbuilder.compile()
+    data = cbuilder.cmdexec('')



More information about the Pypy-commit mailing list