[pypy-issue] [issue1243] pypy ctypes rejects None when used to get a null-pointer

Vincent Pelletier tracker at bugs.pypy.org
Sat Aug 25 15:51:08 CEST 2012

Vincent Pelletier <plr.vincent at gmail.com> added the comment:

It seems this is limited to py_object type.
I worked around it with the following patch (but I don't pass anything besides 
None to this struct member, so it might be stupid).

diff -r 7a75bcc99f30 lib_pypy/_ctypes/primitive.py
--- a/lib_pypy/_ctypes/primitive.py     Fri Aug 24 11:37:23 2012 -0700
+++ b/lib_pypy/_ctypes/primitive.py     Sat Aug 25 15:49:57 2012 +0200
@@ -97,6 +97,7 @@
     'z': from_param_char_p,
     'Z': from_param_char_p,
     'P': from_param_void_p,
+    'O': from_param_void_p,
 class SimpleType(_CDataMeta):

status: unread -> chatting

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list