On May 31, 2006, at 12:49 AM, Neal Norwitz wrote:
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 test_tarfile test_struct test_tarfile /home/pybot/test-trunk/build/Lib/struct.py:63: DeprecationWarning: 'l' format requires -2147483648 <= number <= 2147483647 return o.pack(*args) test_struct test test_struct failed -- pack('>l', -2147483649) did not raise error 1 test OK. 1 test failed: test_struct
I fixed the error message (the min value was off by one before). I think I fixed a few ssize_t 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).
- test_struct only fails if run after test_tarfile.
- The msg from test_struct 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.
It looks like the only thing that's broken here is the test. The behavior changed to consistently allow any integer whatsoever to be passed to struct for all formats (except q and Q which have always done proper range checking). Previously, the range checking was inconsistent across platforms (32-bit and 64-bit anyway) and when using int vs. long.
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?