[issue24470] ctypes incorrect handling of long int on 64bits Linux
Marco Clemencic added the comment: Hi, apologies for the very late answer, but I just discovered that the mails got flagged as spam :( In any case, I do not know where I got this "args" from, but I can confirm that the problem is just a bug on my side. Thanks Marco -- resolution: -> not a bug status: open -> closed ___ Python tracker <http://bugs.python.org/issue24470> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24470] ctypes incorrect handling of long int on 64bits Linux
New submission from Marco Clemencic: When passing a Python int to a C function expecting long int (or void*) via ctypes, the number gets truncated to 32 bits, even if the args types are correctly declared. The workaround is to wrap the argument in c_long (or c_void_p), but the automatic unwrapping of c_long (or c_void_p) in the return type lead to undefined behaviour in code like: myClib.getNumber.restype = c_long myClib.doSomething.args = [c_long] l = myClib.getnumber() myClib.doSomething(l) -- components: ctypes files: test_py.tar.bz2 messages: 245494 nosy: Marco Clemencic priority: normal severity: normal status: open title: ctypes incorrect handling of long int on 64bits Linux type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file39736/test_py.tar.bz2 ___ Python tracker <http://bugs.python.org/issue24470> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com