Lenard Lindstrom <le...@telus.net> added the comment:

I have checked over the proposed patch and made a small change that more 
elegantly obtains PyCArrayType. Decaying arrays into pointers is not an ideal 
solution. Ctypes arrays have bounds checking (pointers do not) adding an extra 
margin of safety when a C function prototype has sized arrays in the 
declaration. But this is a rare case. So the proposed patch is good enough. The 
alternative is to reject arrays as arguments altogether, with CFUNCTYPE raising 
an exception if one is found.

The problem lies with line 1241 in _ctypes.c and line 221 in callbacks.c 
(r84925 or py3k). In the first case, the value of CDataObject.b_ptr is assigned 
to PyCArgObject.value.p. In the second case PyCArgObject.value.p (*pArgs) is 
recovered to *CDataObject.b_ptr. I see no way to fix this without changes to 
several functions and files.

----------
Added file: http://bugs.python.org/file18938/issue1800.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to