[issue2389] Array pickling exposes internal memory representation of elements

Martin v. Löwis report at bugs.python.org
Thu Aug 14 09:18:45 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

I think changing the array constructor is fairly easy: just pick a set
of codes that are defined to be platform-neutral (i.e. for each size two
codes, one for each endianness). For example, the control characters
(\0..\x1F) could be used in the following way:

char, signed-byte, unsigned byte: c, b, B
(big/little)
sint16: 1,2 uint16: 3,4
sint32: 5,6 uint32: 7,8
sint64: 9,10 uint64: 11,12
float:  13,14 double: 15,16
UCS-2:  17,18 UCS-4: 19,20

In above scheme, even codes are little-endian, odd codes are big endian.
Converting the codes to "native" codes could be table-driven.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2389>
_______________________________________


More information about the Python-bugs-list mailing list