[pypy-svn] r23923 - pypy/dist/pypy/rpython/test

arigo at codespeak.net arigo at codespeak.net
Thu Mar 2 18:49:47 CET 2006


Author: arigo
Date: Thu Mar  2 18:49:46 2006
New Revision: 23923

Modified:
   pypy/dist/pypy/rpython/test/test_llinterp.py
Log:
Oups, the last test failed if you run more than 4 tests before.  Added an
official and safe way to clear the getinterpreter() cache.



Modified: pypy/dist/pypy/rpython/test/test_llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_llinterp.py	(original)
+++ pypy/dist/pypy/rpython/test/test_llinterp.py	Thu Mar  2 18:49:46 2006
@@ -65,6 +65,10 @@
 
 _lastinterpreted = []
 _tcache = {}
+def clear_tcache():
+    del _lastinterpreted[:]
+    _tcache.clear()
+
 def get_interpreter(func, values, view='auto', viewbefore='auto', policy=None,
                     someobjects=False, type_system="lltype"):
     key = (func,) + tuple([typeOf(x) for x in values])+ (someobjects,)
@@ -427,7 +431,7 @@
 
 def test_cleanup_finally():
     interp, graph = get_interpreter(cleanup_f, [-1])
-    _tcache.clear()    # because we hack the graph in place
+    clear_tcache()    # because we hack the graph in place
     operations = graph.startblock.operations
     assert operations[0].opname == "direct_call"
     assert operations[1].opname == "direct_call"
@@ -452,7 +456,7 @@
 
 def test_cleanup_except():
     interp, graph = get_interpreter(cleanup_f, [-1])
-    _tcache.clear()    # because we hack the graph in place
+    clear_tcache()    # because we hack the graph in place
     operations = graph.startblock.operations
     assert operations[0].opname == "direct_call"
     assert operations[1].opname == "direct_call"



More information about the Pypy-commit mailing list