cpython/Modules/_ctypes
Pauli Virtanen 07f1658aa0 bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (#31)
Ctypes currently produces wrong pep3118 type codes for several types.
E.g. memoryview(ctypes.c_long()).format gives "<l" on 64-bit platforms,
but it should be "<q" instead for sizeof(c_long) == 8

The problem is that the '<>' endian specification in the struct syntax
also turns on the "standard size" mode, which makes type characters have
a platform-independent meaning, which does not match with the codes used
internally in ctypes.  The struct module format syntax also does not
allow specifying native-size non-native-endian items.

This commit adds a converter function that maps the internal ctypes
codes to appropriate struct module standard-size codes in the pep3118
format strings. The tests are modified to check for this.
2017-08-28 14:08:49 +02:00
..
darwin Recorded merge of revisions 81032 via svnmerge from 2010-05-09 16:14:21 +00:00
libffi_msvc Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) 2017-02-20 00:16:33 +00:00
libffi_osx Issue #24381: Avoid unused function warning when building bundled macOS libffi. 2016-10-20 15:38:27 -04:00
_ctypes.c bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (#31) 2017-08-28 14:08:49 +02:00
_ctypes_test.c bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559) 2017-06-07 18:42:24 +01:00
_ctypes_test.h Copy ctypes-0.9.9.4 sources from external into the trunk. 2006-03-08 19:35:11 +00:00
callbacks.c Issue #28915: Use _PyObject_CallNoArg() 2016-12-09 12:29:18 +01:00
callproc.c Fix compiler warnings on Windows introduced in bpo-13617. (#2464) 2017-06-28 09:55:22 +03:00
cfield.c bpo-28129: fix ctypes crashes (#386) 2017-03-02 18:42:40 +01:00
ctypes.h fix a PY_LONG_LONG straggler 2016-09-08 09:25:03 -07:00
ctypes_dlfcn.h Remove outdated PEP 291 compatibility requirement comment 2016-05-14 05:55:38 +00:00
malloc_closure.c Fix for issue9662, patch by Łukasz Langa in issue5504. 2010-09-05 18:25:59 +00:00
stgdict.c bpo-15695: Implemented StgDict.__sizeof__(). (#509) 2017-03-12 11:12:30 +02:00