cpython/Modules/_ctypes
Pauli Virtanen 2d1653aa43 [3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3241)
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.
(cherry picked from commit 07f1658aa0)
2017-08-30 11:40:05 +02:00
..
darwin
libffi more linux -> __linux__ 2016-09-07 14:45:10 -07:00
libffi_msvc Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) (#220) 2017-02-22 06:21:17 +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 [3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3241) 2017-08-30 11:40:05 +02:00
_ctypes_test.c bpo-29939: suppress compiler warnings in _ctypes_test (#1038) 2017-04-07 23:23:08 +01:00
_ctypes_test.h
callbacks.c Merge 3.5 (issue #11048) 2016-07-27 16:59:22 +02:00
callproc.c [3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) (#2462) 2017-06-28 09:27:35 +03:00
cfield.c [3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) (#2443) 2017-06-27 21:08:58 +03: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
libffi.diff - Issue #22176: Fix build failure on ARM with -Werror=declaration-after-statement 2014-08-10 00:01:04 +02:00
malloc_closure.c
stgdict.c Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize 2016-11-20 09:13:07 +02:00