array and struct 64-bit Linux change in behavior Python 3.7 and 2.7
On Dec 2, 2019, at 12:32 PM, Chris Clark <Chris.Clark at actian.com> wrote:
> ?Test case:
> import array
> array.array('L', )
> # x.itemsize == 8 rather than 4
> This works fine (returns 4) under Windows Python 3.7.3 64-bit build.
> Under Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64-bit this returns 8. Documentation at https://docs.python.org/3/library/array.html explicitly states 'L' is for size 4.
> It impacts all uses types of array (e.g. reading from byte strings).
> The struct module is a little different:
> import struct
> x = struct.pack('L', 0)
> # len(x) ===8 rather than 4
> This can be worked around by using '=L' - which is not well documented - so this maybe a doc issue.
> Wanted to post here for comments before opening a bug at https://bugs.python.org/
> Is anyone seeing this under Debian/Ubuntu?
Documentation that I see says *Minimum* size is 4, nothing says that it will be 4
I wouldn?t be surprized if ?I? gave you a size of 4 on that platform (and maybe even on many 32 bit platforms too)