Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-02 09:55:16 -0800, Rob Gaddi wrote: > The struct situation is, as you said, a bit different. I believe that with > the default native alignment @, you're seeing 4-byte data padded to an > 8-byte alignment, not 8-byte data. Nope. That's really an 8 byte long: Python 3.7.3 (default,

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-05 09:27:43 +, Barry Scott wrote: > On 3 Dec 2019, at 01:50, Richard Damon wrote: > > On 12/2/19 4:25 PM, Barry Scott wrote: > > x=struct.pack('L',0x102030405) > > x > >> b'\x05\x04\x03\x02\x01\x00\x00\x00' > >> > >> Given I have exact control with b, h, i, and q but L is n

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-05 Thread Barry Scott
> On 3 Dec 2019, at 01:50, Richard Damon wrote: > > On 12/2/19 4:25 PM, Barry Scott wrote: >> >>> On 2 Dec 2019, at 17:55, Rob Gaddi >>> wrote: >>> >>> On 12/2/19 9:26 AM, Chris Clark wrote: Test case: import array array.array('L', [0]) # x.i

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Chris Angelico
On Wed, Dec 4, 2019 at 4:16 PM Chris Clark wrote: > I think the consensus from the various threads is that the docs are either > lacking or misleading. > > I mentioned that this impacts bytes and the problem there is more telling as > it hard fails (this is how I first discovered this was an iss

RE: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Chris Clark
array('L', [0]) if x.itemsize == 4: FMT_ARRAY_4BYTE = 'L' FMT_STRUCT_4BYTE = ' Sent: Monday, December 2, 2019 5:50 PM To: python-list@python.org Subject: Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7 On 12/2/

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Rob Gaddi
On 12/2/19 5:50 PM, Richard Damon wrote: Perhaps array could be extended so that it took '4' for a 4 byte integer and '8' for an 8 byte integer (maybe 'U4' and 'U8' for unsigned). Might as well also allow 1 and 2 for completeness for char and short (but those are currently consistent). I wil

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
On 12/2/19 4:25 PM, Barry Scott wrote: > >> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: >> >> On 12/2/19 9:26 AM, Chris Clark wrote: >>> Test case: >>>import array >>>array.array('L', [0]) >>> # x.itemsize == 8 rather than 4 >>> This works fine (returns 4) under Wind

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Christian Heimes
On 02/12/2019 22.25, Barry Scott wrote: > > >> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: >> >> On 12/2/19 9:26 AM, Chris Clark wrote: >>> Test case: >>>import array >>>array.array('L', [0]) >>> # x.itemsize == 8 rather than 4 >>> This works fine (returns 4) under

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Barry Scott
> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: > > On 12/2/19 9:26 AM, Chris Clark wrote: >> Test case: >>import array >>array.array('L', [0]) >> # x.itemsize == 8 rather than 4 >> This works fine (returns 4) under Windows Python 3.7.3 64-bit build. >> Under Ubunt

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Rob Gaddi
On 12/2/19 9:26 AM, Chris Clark wrote: Test case: import array array.array('L', [0]) # 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. Docum

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
On Dec 2, 2019, at 12:32 PM, Chris Clark wrote: > > Test case: > > import array > array.array('L', [0]) > # 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

array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Chris Clark
Test case: import array array.array('L', [0]) # 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/libra