[pypy-svn] r54864 - in pypy/dist/pypy/rpython/tool: . test

arigo at codespeak.net arigo at codespeak.net
Sat May 17 18:47:30 CEST 2008


Author: arigo
Date: Sat May 17 18:47:29 2008
New Revision: 54864

Modified:
   pypy/dist/pypy/rpython/tool/rffi_platform.py
   pypy/dist/pypy/rpython/tool/test/test_rffi_platform.py
Log:
Test and fix.


Modified: pypy/dist/pypy/rpython/tool/rffi_platform.py
==============================================================================
--- pypy/dist/pypy/rpython/tool/rffi_platform.py	(original)
+++ pypy/dist/pypy/rpython/tool/rffi_platform.py	Sat May 17 18:47:29 2008
@@ -100,6 +100,7 @@
         name = self.entries[entry]
         info = self.info[name]
         self.result[entry] = entry.build_result(info, self)
+        return self.result[entry]
 
     def get_result(self):
         return dict([(name, self.result[entry])

Modified: pypy/dist/pypy/rpython/tool/test/test_rffi_platform.py
==============================================================================
--- pypy/dist/pypy/rpython/tool/test/test_rffi_platform.py	(original)
+++ pypy/dist/pypy/rpython/tool/test/test_rffi_platform.py	Sat May 17 18:47:29 2008
@@ -175,6 +175,29 @@
     assert isinstance(c_y, lltype.Struct)
     assert c_y.c_x is c_x
 
+def test_nested_structs_in_the_opposite_order():
+    class CConfig:
+        _compilation_info_ = ExternalCompilationInfo(
+            post_include_lines="""
+            struct y {
+            int foo;
+            unsigned long bar;
+            };
+            struct x {
+            char c;
+            struct y y;
+            };
+            """.split("\n"))
+        y = rffi_platform.Struct("struct y", [("bar", rffi.SHORT)])
+        x = rffi_platform.Struct("struct x", [("y", y)])
+
+    res = rffi_platform.configure(CConfig)
+    c_x = res["x"]
+    c_y = res["y"]
+    assert isinstance(c_x, lltype.Struct)
+    assert isinstance(c_y, lltype.Struct)
+    assert c_x.c_y is c_y
+
 def test_array():
     dirent = rffi_platform.getstruct("struct dirent",
                                        """



More information about the Pypy-commit mailing list