[pypy-svn] r22754 - in pypy/dist/pypy/rpython/rctypes: . test

stephan at codespeak.net stephan at codespeak.net
Fri Jan 27 19:14:40 CET 2006


Author: stephan
Date: Fri Jan 27 19:14:38 2006
New Revision: 22754

Modified:
   pypy/dist/pypy/rpython/rctypes/implementation.py
   pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
Log:
added one disabled structure specialize test

Modified: pypy/dist/pypy/rpython/rctypes/implementation.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/implementation.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/implementation.py	Fri Jan 27 19:14:38 2006
@@ -88,12 +88,12 @@
                 else:
                     answer.append(ctype_type.wrap_arg(ll_type, arg_name))
             return answer
-
-class CtypesBasicTypeInstantiationTranslation( FunctionPointerTranslation ):
-
-    compute_result_annotation = classmethod(
-            FunctionPointerTranslation.compute_result_annotation)
-
+#
+#class CtypesBasicTypeInstantiationTranslation( FunctionPointerTranslation ):
+#
+#    compute_result_annotation = classmethod(
+#            FunctionPointerTranslation.compute_result_annotation)
+#
     
 class RStructureMeta(type(Structure)):
     def __new__(mta,name,bases,clsdict):
@@ -114,6 +114,9 @@
         return SomeCTypesObject(cls)
     compute_annotation = classmethod(compute_annotation)
 
+    def specialize(self, hop):
+        raise NotImplementedError
+
     def compute_result_annotation(cls, *args_s):
         """
         Answer the result annotation of calling 'cls'.

Modified: pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/test/test_rctypes.py	Fri Jan 27 19:14:38 2006
@@ -23,6 +23,7 @@
 else:
     py.test.skip("don't know how to load the c lib for %s" % 
             sys.platform)
+
 atoi = mylib.atoi
 atoi.restype = c_int
 atoi.argtypes = [c_char_p]
@@ -153,6 +154,13 @@
     my_array = c_int_10()
     return my_array[-11]
 
+def py_test_specialize_struct():
+    p = tagpoint()
+    p.x = 1
+    p.y = 2
+
+    return p.x
+
 
 class Test_rctypes:
 
@@ -270,6 +278,14 @@
         s = a.build_types(py_test_simple_ctypes_non_const,[])
         assert s.knowntype == c_float
 
+    def x_test_specialize_struct(self):
+        t = TranslationContext()
+        a = t.buildannotator()
+        s = a.build_types(py_test_specialize_struct, [])
+        # result should be an integer
+        assert s.knowntype == int
+        t.buildrtyper().specialize()
+        #d#t.view()
 
 class Test_array:
 



More information about the Pypy-commit mailing list