[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:19:37 CEST 2012
New submission from Vincent Pelletier <plr.vincent at gmail.com>:
pypy1.9:
>>>> import ctypes
>>>> class Foo(ctypes.Structure):
.... _fields_ = (('user_data', ctypes.py_object), )
....
>>>> a = Foo()
>>>> a.user_data = None
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/vincent/git/ITI1480A-linux/pypy-1.9/lib_pypy/_ctypes/structure.py", line 105, in __set__
cobj = fieldtype.from_param(value)
File "/home/vincent/git/ITI1480A-linux/pypy-1.9/lib_pypy/_ctypes/primitive.py", line 287, in from_param
return super(SimpleType, self).from_param(value)
File "/home/vincent/git/ITI1480A-linux/pypy-1.9/lib_pypy/_ctypes/basics.py", line 46, in from_param
self.__name__, type(value).__name__))
TypeError: expected py_object instance instead of NoneType
cpython 2.7.3:
>>> import ctypes
>>> class Foo(ctypes.Structure):
... _fields_ = (('user_data', ctypes.py_object), )
...
>>> a = Foo()
>>> a.user_data = None
----------
messages: 4674
nosy: pypy-issue, vpelletier
priority: bug
status: unread
title: pypy ctypes rejects None when used to get a null-pointer
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1243>
________________________________________
More information about the pypy-issue
mailing list