• Pauli Virtanen's avatar
    [3.6] bpo-10746: Fix ctypes PEP 3118 type codes for c_long, c_bool, c_int (GH-31) (#3241) · 2d1653aa
    Pauli Virtanen yazdı
    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 07f1658a)
    2d1653aa
Adı
Son kayıt (commit)
Son güncelleme
..
darwin Loading commit data...
libffi Loading commit data...
libffi_msvc Loading commit data...
libffi_osx Loading commit data...
_ctypes.c Loading commit data...
_ctypes_test.c Loading commit data...
_ctypes_test.h Loading commit data...
callbacks.c Loading commit data...
callproc.c Loading commit data...
cfield.c Loading commit data...
ctypes.h Loading commit data...
ctypes_dlfcn.h Loading commit data...
libffi.diff Loading commit data...
malloc_closure.c Loading commit data...
stgdict.c Loading commit data...