[pypy-commit] pypy faster-rstruct-2: bah, the two tests shared the same cache, which means that they worked if invoked separately but broke if you tested the whole file

antocuni pypy.commits at gmail.com
Fri May 19 10:01:17 EDT 2017


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91345:ca5fc3f48609
Date: 2017-05-19 16:00 +0200
http://bitbucket.org/pypy/pypy/changeset/ca5fc3f48609/

Log:	bah, the two tests shared the same cache, which means that they
	worked if invoked separately but broke if you tested the whole file

diff --git a/rpython/translator/c/test/test_llop.py b/rpython/translator/c/test/test_llop.py
--- a/rpython/translator/c/test/test_llop.py
+++ b/rpython/translator/c/test/test_llop.py
@@ -5,10 +5,11 @@
 
 
 class TestLLOp(BaseLLOpTest):
-    cache = {}
+    cache_load = {}
+    cache_store = {}
 
     def gc_load_from_string(self, TYPE, buf, offset):
-        if TYPE not in self.cache:
+        if TYPE not in self.cache_load:
             assert isinstance(TYPE, lltype.Primitive)
             if TYPE in (lltype.Float, lltype.SingleFloat):
                 TARGET_TYPE = lltype.Float
@@ -20,14 +21,14 @@
                 return lltype.cast_primitive(TARGET_TYPE, x)
 
             fn = compile(llf, [str, int])
-            self.cache[TYPE] = fn
+            self.cache_load[TYPE] = fn
         #
-        fn = self.cache[TYPE]
+        fn = self.cache_load[TYPE]
         x = fn(buf, offset)
         return lltype.cast_primitive(TYPE, x)
 
     def newlist_and_gc_store(self, TYPE, value, expected):
-        if TYPE not in self.cache:
+        if TYPE not in self.cache_store:
             assert isinstance(TYPE, lltype.Primitive)
             if TYPE in (lltype.Float, lltype.SingleFloat):
                 argtype = float
@@ -40,8 +41,8 @@
                 return ''.join(lst)
 
             fn = compile(llf, [argtype])
-            self.cache[TYPE] = fn
+            self.cache_store[TYPE] = fn
         #
-        fn = self.cache[TYPE]
+        fn = self.cache_store[TYPE]
         got = fn(value)
         assert got == expected


More information about the pypy-commit mailing list