Martin Panter <vadmium...@gmail.com> added the comment:
This problem is common to structure fields in general, not just "c_void_p". I recently encountered it with a different type (don't remember the type now, but I notice plain types like c_int share the problem). I found <https://stackoverflow.com/questions/13389816/ctypes-passing-a-pointer-to-a-field-in-a-struct> which suggests using the undocumented "offset" attribute of the structure fields. In your case you might be able to do: print_ptraddress(byref(effect, Effect.ptr.offset)) however the pointer data type will be wrong. Maybe you can also do print_ptraddress(c_void_p.from_buffer(effect, Effect.ptr.offset)) although there is no automatic type checking that Effect.ptr refers to a c_void_p data type. Unless there is a better way, I think the "offset" attribute of structure fields should be documented. ---------- nosy: +martin.panter _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35390> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com