[pypy-svn] r45699 - in pypy/branch/pypy-more-rtti-inprogress/rpython/tool: . test
arigo at codespeak.net
arigo at codespeak.net
Thu Aug 16 10:52:02 CEST 2007
Author: arigo
Date: Thu Aug 16 10:52:01 2007
New Revision: 45699
Modified:
pypy/branch/pypy-more-rtti-inprogress/rpython/tool/rfficache.py
pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_rfficache.py
Log:
The same cache is used for various purposes, which can occasionally collide.
Make the key more precise.
Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/tool/rfficache.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/tool/rfficache.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/tool/rfficache.py Thu Aug 16 10:52:01 2007
@@ -62,10 +62,10 @@
def create_cache_access_method(acc_func, meth_name):
def method(self, name, **kwds):
try:
- return self.cache[name]
+ return self.cache[meth_name, name]
except KeyError:
res = acc_func(name, **kwds)
- self.cache[name] = res
+ self.cache[meth_name, name] = res
self._store_cache()
return res
method.func_name = meth_name
@@ -91,7 +91,7 @@
def _build_types(self):
for name, (c_name, signed) in self.type_names.items():
- bits = self.cache[c_name]
+ bits = self.cache['bits', c_name]
inttype = rarithmetic.build_int('r_' + name, signed, bits)
tp = lltype.build_number(name, inttype)
self.numbertype_to_rclass[tp] = inttype
@@ -104,7 +104,7 @@
except KeyError:
bits = sizeof_c_type(c_name, **kwds) * 8
inttype = rarithmetic.build_int('r_' + name, signed, bits)
- self.cache[c_name] = bits
+ self.cache['bits', c_name] = bits
self.type_names[name] = (c_name, signed)
tp = lltype.build_number(name, inttype)
self.numbertype_to_rclass[tp] = inttype
Modified: pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_rfficache.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_rfficache.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/rpython/tool/test/test_rfficache.py Thu Aug 16 10:52:01 2007
@@ -28,6 +28,8 @@
assert cache.defined('STUFF')
assert cache.inttype('uchar', 'unsigned char', False, compiler_exe='xxx')._type.BITS == 8
assert cache.sizeof('short', compiler_exe='xxx') == 2
+ assert cache.intdefined('STUFFZ', add_source='#define STUFFZ 0') == 0
+ assert cache.defined('STUFFZ', add_source='#define STUFFZ 0')
def test_types_present():
for name in rffi.TYPES:
More information about the Pypy-commit
mailing list