cpython: 88f2c4f12b56 (original) (raw)

Mercurial > cpython

changeset 97122:88f2c4f12b56 2.7

Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch written by Matthieu Gautier. [#23319]

Victor Stinner victor.stinner@gmail.com
date Wed, 29 Jul 2015 14:37:17 +0200
parents 8afd995802a6
children 12b353f76447
files Lib/ctypes/test/test_bitfields.py Misc/NEWS Modules/_ctypes/cfield.c
diffstat 3 files changed, 32 insertions(+), 0 deletions(-)[+] [-] Lib/ctypes/test/test_bitfields.py 28 Misc/NEWS 3 Modules/_ctypes/cfield.c 1

line wrap: on

line diff

--- a/Lib/ctypes/test/test_bitfields.py +++ b/Lib/ctypes/test/test_bitfields.py @@ -259,5 +259,33 @@ class BitFieldTest(unittest.TestCase): x.a = 0xFEDCBA9876543211 self.assertEqual(x.a, 0xFEDCBA9876543211)

+

+ if name == "main": unittest.main()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,9 @@ Core and Builtins Library ------- +- Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch

--- a/Modules/_ctypes/cfield.c +++ b/Modules/ctypes/cfield.c @@ -769,6 +769,7 @@ I_set_sw(void *ptr, PyObject *value, Py if (get_ulong(value, &val) < 0) return NULL; memcpy(&field, ptr, sizeof(field));