[Python-Dev] test_struct failure on 64 bit platforms (original) (raw)

Neal Norwitz nnorwitz at gmail.com
Wed May 31 11:04:31 CEST 2006


On 5/31/06, Bob Ippolito <bob at redivi.com> wrote:

On May 31, 2006, at 12:49 AM, Neal Norwitz wrote: > Bob, > > There are a couple of things I don't understand about the new struct. > Below is a test that fails. > > $ ./python ./Lib/test/regrtest.py testtarfile teststruct > testtarfile > /home/pybot/test-trunk/build/Lib/struct.py:63: DeprecationWarning: 'l' > format requires -2147483648 <= number <= 2147483647_ _> return o.pack(*args) > teststruct > test teststruct failed -- pack('>l', -2147483649) did not raise error > 1 test OK. > 1 test failed: > teststruct > > #### > > I fixed the error message (the min value was off by one before). I > think I fixed a few ssizet issues too. > > The remaining issues I know of are: > * The warning only appears on 64-bit platforms. > * The warning doesn't seem correct for 64-bit platforms (l is 8 > bytes, not 4). > * teststruct only fails if run after testtarfile. > * The msg from teststruct doesn't seem correct for 64-bit platforms. > > I tracked the problem down to trying to write the gzip tar file. Can > you fix this? The warning is correct, and so is the size. Only native formats have native sizes; l and i are exactly 4 bytes on all platforms when using =, >, <, or !. That's what "std size and alignment" means.

Ah, you are correct. I see this is the behaviour in 2.4. Though I wouldn't call 4 bytes a standard size on a 64-bit platform.

Unfortunately I don't have a 64-bit platform easily accessible and I have no idea which test it is that's raising the warning. Could you isolate it?

I wasted sleep for that? Damn and I gotta get up early again tomorrow too. See the checkin for answer. Would someone augment the warnings module to make testing more reasonable?

n



More information about the Python-Dev mailing list