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

arigo at codespeak.net arigo at codespeak.net
Mon Apr 10 19:28:52 CEST 2006


Author: arigo
Date: Mon Apr 10 19:28:51 2006
New Revision: 25674

Modified:
   pypy/dist/pypy/rpython/rctypes/rpointer.py
   pypy/dist/pypy/rpython/rctypes/test/test_ctypes.py
Log:
The result of some ctypes source code reading...


Modified: pypy/dist/pypy/rpython/rctypes/rpointer.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/rpointer.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/rpointer.py	Mon Apr 10 19:28:51 2006
@@ -1,4 +1,5 @@
 from pypy.rpython.rmodel import Repr, IntegerRepr, inputconst
+from pypy.rpython.error import TyperError
 from pypy.rpython import extregistry
 from pypy.rpython.lltypesystem import lltype
 from pypy.annotation import model as annmodel
@@ -82,7 +83,8 @@
         if hop.args_s[1].is_constant() and hop.args_s[1].const == 0:
             pass
         else:
-            raise NotImplementedError("XXX: pointer[non-zero-index] = value")
+            # not supported by ctypes either
+            raise TyperError("assignment to pointer[x] with x != 0")
         # copy the whole structure's content over
         reccopy(hop.llops, v_new_c_data, v_target)
 

Modified: pypy/dist/pypy/rpython/rctypes/test/test_ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/test/test_ctypes.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/test/test_ctypes.py	Mon Apr 10 19:28:51 2006
@@ -42,16 +42,15 @@
     pp[0].contents = z                       #  pp ---> p ---> z = 84
     assert p.contents.value == z.value == 84
 
-    py.test.skip("the rest fails sometimes -- did I get my keepalive"
-                 "expectations wrong?")
-
-    q = pointer(y)
-    pp[0] = q                                #  pp ---> p ---> y = 14
-    assert y.value == 14                     #        (^^^ not q! )
-    assert p.contents.value == 14
-    assert pp.contents.contents.value == 14
-    q.contents = x
-    assert pp.contents.contents.value == 14
+##    *** the rest is commented out because it should work but occasionally
+##    *** trigger a ctypes bug (SourceForge bug #1467852). ***
+##    q = pointer(y)
+##    pp[0] = q                                #  pp ---> p ---> y = 14
+##    assert y.value == 14                     #        (^^^ not q! )
+##    assert p.contents.value == 14
+##    assert pp.contents.contents.value == 14
+##    q.contents = x
+##    assert pp.contents.contents.value == 14
 
 
 def test_char_p():



More information about the Pypy-commit mailing list