[Python-Dev] [docs] undocumented argtypes magic in ctypes?
Eli Bendersky
eliben at gmail.com
Thu Mar 7 15:09:58 CET 2013
On Thu, Mar 7, 2013 at 5:53 AM, Thomas Heller <theller at ctypes.org> wrote:
> ctypes seems to auto-convert arguments when argtypes is
>> specified. This
>> fact is documented. However, I'm not sure whether this
>> auto-conversion
>> is advanced enough to apply byref. Because otherwise, DIRENT is
>> certainly not convertible to DIRENT_p
>>
>> If argtypes specify a 'POINTER(X)' type as an argument, then ctypes
>> automatically applies byref() if an 'X' instance is passed to the
>> actual call. This is by design, but I'm not sure if it is documented
>> or not.
>>
>> However, if argtypes is not given, this does (and of course cannot)
>> work.
>>
>> Great, thanks for confirming this, Thomas. I had the feeling it's a
>> documentation issue (hence I sent it to the docs@ list first), because
>> the behavior seems very deliberate and looking at the code of ctypes I
>> did see conversions going on.
>>
>> Have I missed that this is documented somewhere, or should I open a docs
>> issue?
>>
>
> I didn't find anything in the docs (in the two minutes I spent for that),
> so please open a docs issue, or, better, fix it.
http://bugs.python.org/issue17378, has a patch already. Please take a look.
Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130307/397c67fc/attachment.html>
More information about the Python-Dev
mailing list