cpython: 72e73fa03124 (original) (raw)

Mercurial > cpython

changeset 71311:72e73fa03124 3.2

Close #4376: ctypes now supports nested structures in a endian different than the parent structure. Patch by Vlad Riscutia. [#4376]

Victor Stinner victor.stinner@haypocalc.com
date Wed, 13 Jul 2011 21:43:18 +0200
parents 2b97f5220940
children 637210b9d054 d050c8c9a3b3
files Lib/ctypes/_endian.py Lib/ctypes/test/test_byteswap.py Misc/ACKS Misc/NEWS
diffstat 4 files changed, 39 insertions(+), 17 deletions(-)[+] [-] Lib/ctypes/_endian.py 16 Lib/ctypes/test/test_byteswap.py 36 Misc/ACKS 1 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/ctypes/_endian.py +++ b/Lib/ctypes/_endian.py @@ -7,14 +7,18 @@ def _other_endian(typ): """Return the type with the 'other' byte order. Simple types like c_int and so on already have ctype_be and ctype_le attributes which contain the types, for more complicated types

class _swapped_meta(type(Structure)): def setattr(self, attrname, value):

--- a/Lib/ctypes/test/test_byteswap.py +++ b/Lib/ctypes/test/test_byteswap.py @@ -185,18 +185,32 @@ class Test(unittest.TestCase): self.assertRaises(TypeError, setattr, T, "fields", [("x", typ)]) def test_struct_struct(self):

+

+

+

def test_struct_fields_2(self): # standard packing in struct uses no alignment.

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -735,6 +735,7 @@ Jan Pieter Riegel Armin Rigo Nicholas Riley Jean-Claude Rimbault +Vlad Riscutia Juan M. Bello Rivas Davide Rizzo Anthony Roach

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Core and Builtins Library ------- +- Issue #4376: ctypes now supports nested structures in a endian different than