On Thu, Mar 7, 2013 at 3:37 AM, Thomas Heller <thel...@ctypes.org> wrote:

> Am 06.03.2013 18:19, schrieb Eli Bendersky:
>
>>
>>
>>
>> On Wed, Mar 6, 2013 at 8:33 AM, Andrew Svetlov <andrew.svet...@gmail.com
>> <mailto:andrew.svetlov@gmail.**com <andrew.svet...@gmail.com>>> wrote:
>>
>>     Looks like bug for me.
>>
>>
>> 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?

Eli
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to