<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 7, 2013 at 3:37 AM, Thomas Heller <span dir="ltr"><<a href="mailto:theller@ctypes.org" target="_blank">theller@ctypes.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 06.03.2013 18:19, schrieb Eli Bendersky:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
<br>
On Wed, Mar 6, 2013 at 8:33 AM, Andrew Svetlov <<a href="mailto:andrew.svetlov@gmail.com" target="_blank">andrew.svetlov@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:andrew.svetlov@gmail.com" target="_blank">andrew.svetlov@gmail.<u></u>com</a>>> wrote:<br>
<br>
    Looks like bug for me.<br>
<br>
<br>
ctypes seems to auto-convert arguments when argtypes is specified. This<br>
fact is documented. However, I'm not sure whether this auto-conversion<br>
is advanced enough to apply byref. Because otherwise, DIRENT is<br>
certainly not convertible to DIRENT_p<br>
</div></blockquote>
<br>
If argtypes specify a 'POINTER(X)' type as an argument, then ctypes<br>
automatically applies byref() if an 'X' instance is passed to the<br>
actual call.  This is by design, but I'm not sure if it is documented<br>
or not.<br>
<br>
However, if argtypes is not given, this does (and of course cannot) work.<br></blockquote></div><br></div><div class="gmail_extra">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.<br>

<br></div><div class="gmail_extra">Have I missed that this is documented somewhere, or should I open a docs issue?<br><br>Eli<br></div><div class="gmail_extra"><br><br></div><div class="gmail_extra"><br></div></div>