summaryrefslogtreecommitdiff
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-07-29 14:37:17 +0200
committerVictor Stinner <victor.stinner@gmail.com>2015-07-29 14:37:17 +0200
commite97944a27e836f68f6b42393885999f3bcdce36b (patch)
treeb0e9e13169005cefea145d3b67811613b2198dd1 /Modules/_ctypes
parent2f2c829688a42828d2be85118d26ea5bb41266eb (diff)
downloadcpython-git-e97944a27e836f68f6b42393885999f3bcdce36b.tar.gz
Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch
written by Matthieu Gautier.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/cfield.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 76c72f877a..85b5ad2890 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -769,6 +769,7 @@ I_set_sw(void *ptr, PyObject *value, Py_ssize_t size)
if (get_ulong(value, &val) < 0)
return NULL;
memcpy(&field, ptr, sizeof(field));
+ field = SWAP_INT(field);
field = SET(unsigned int, field, (unsigned int)val, size);
field = SWAP_INT(field);
memcpy(ptr, &field, sizeof(field));