[pypy-svn] r71862 - in pypy/branch/ctypes-configure-cache-2/ctypes_configure: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Mar 6 13:58:33 CET 2010
Author: arigo
Date: Sat Mar 6 13:58:27 2010
New Revision: 71862
Modified:
pypy/branch/ctypes-configure-cache-2/ctypes_configure/dumpcache.py
pypy/branch/ctypes-configure-cache-2/ctypes_configure/test/test_dumpcache.py
Log:
Write the multiplication in the other order.
Fixes an obscure test (it would be ok for this test
to fail, but not give a wrong result).
Modified: pypy/branch/ctypes-configure-cache-2/ctypes_configure/dumpcache.py
==============================================================================
--- pypy/branch/ctypes-configure-cache-2/ctypes_configure/dumpcache.py (original)
+++ pypy/branch/ctypes-configure-cache-2/ctypes_configure/dumpcache.py Sat Mar 6 13:58:27 2010
@@ -39,5 +39,5 @@
if isinstance(cls, ctypes._SimpleCData.__class__):
return "ctypes." + cls.__name__
if hasattr(cls, '_length_') and hasattr(cls, '_type_'): # assume an array
- return '%d * %s' % (cls._length_, ctypes_repr(cls._type_))
+ return '%s*%d' % (ctypes_repr(cls._type_), cls._length_)
raise NotImplementedError("saving of object with type %r" % type(cls))
Modified: pypy/branch/ctypes-configure-cache-2/ctypes_configure/test/test_dumpcache.py
==============================================================================
--- pypy/branch/ctypes-configure-cache-2/ctypes_configure/test/test_dumpcache.py (original)
+++ pypy/branch/ctypes-configure-cache-2/ctypes_configure/test/test_dumpcache.py Sat Mar 6 13:58:27 2010
@@ -49,3 +49,13 @@
d = {}
execfile(str(cachefile), d)
assert d['foo'] == res['foo']
+
+def test_cache_array_array():
+ configdir = configure.configdir
+ res = {'foo': (ctypes.c_int * 2) * 3}
+ cachefile = configdir.join('cache_array_array')
+ dumpcache.dumpcache('', str(cachefile), res)
+ #
+ d = {}
+ execfile(str(cachefile), d)
+ assert d['foo'] == res['foo']
More information about the Pypy-commit
mailing list