Author kermode
Recipients BreamoreBoy, belopolsky, kermode, theller
Date 2010-09-20.18:55:08
SpamBayes Score 2.45447e-09
Marked as misclassified No
Message-id <1285008925.68.0.554329545312.issue1800@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-09-20 18:55:25kermodesetrecipients: + kermode, theller, belopolsky, BreamoreBoy
2010-09-20 18:55:25kermodesetmessageid: <1285008925.68.0.554329545312.issue1800@psf.upfronthosting.co.za>
2010-09-20 18:55:10kermodelinkissue1800 messages
2010-09-20 18:55:09kermodecreate