[pypy-svn] r72829 - in pypy/branch/fix-64/pypy/rpython/tool: . test

arigo at codespeak.net arigo at codespeak.net
Thu Mar 25 17:49:57 CET 2010


Author: arigo
Date: Thu Mar 25 17:49:56 2010
New Revision: 72829

Modified:
   pypy/branch/fix-64/pypy/rpython/tool/rffi_platform.py
   pypy/branch/fix-64/pypy/rpython/tool/test/test_rffi_platform.py
Log:
One more test, fix the code.


Modified: pypy/branch/fix-64/pypy/rpython/tool/rffi_platform.py
==============================================================================
--- pypy/branch/fix-64/pypy/rpython/tool/rffi_platform.py	(original)
+++ pypy/branch/fix-64/pypy/rpython/tool/rffi_platform.py	Thu Mar 25 17:49:56 2010
@@ -532,6 +532,7 @@
                 # succeeded with 'i' pads.  Drop all pads beyond that.
                 drops += consecutive_pads[i:]
             consecutive_pads = []
+        drops += consecutive_pads   # drop the final pads too
         self.cache = drops
 
 class _PaddingDropFieldLookup(CConfigEntry):

Modified: pypy/branch/fix-64/pypy/rpython/tool/test/test_rffi_platform.py
==============================================================================
--- pypy/branch/fix-64/pypy/rpython/tool/test/test_rffi_platform.py	(original)
+++ pypy/branch/fix-64/pypy/rpython/tool/test/test_rffi_platform.py	Thu Mar 25 17:49:56 2010
@@ -347,3 +347,13 @@
                                    'c__pad3', 'c__pad4')
     d = {'c_c1': 'char', 'c_i1': 'int', 'c_s1': 'short'}
     assert S._hints['get_padding_drop'](d) == ['c__pad1', 'c__pad2', 'c__pad4']
+    #
+    S = rffi_platform.getstruct("foobar_t", """
+           typedef struct {
+                char c1;
+                long l2;  /* some number of _pads */
+           } foobar_t;
+           """, [("c1", lltype.Signed)])
+    padding = list(S._hints['padding'])
+    d = {'c_c1': 'char'}
+    assert S._hints['get_padding_drop'](d) == padding



More information about the Pypy-commit mailing list