[Python-Dev] test_itertools fails for trunk on x86 OS X machine

Neal Norwitz nnorwitz at gmail.com
Fri Sep 22 08:37:37 CEST 2006

On 9/21/06, Tim Peters <tim.peters at gmail.com> wrote:
> Well, to be strictly anal, while the result of
>     (size_t)-123
> is defined, the result of casting /that/ back to a signed type of the
> same width is not defined.  Maybe your compiler was "doing you a
> favor" ;-)

I also tried with a cast to an ssize_t and replacing %zd with an %zi.
None of them make a difference; all return an unsigned value.  This is
with powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple
Computer, Inc. build 4061).  Although i would expect the issue is in
the std C library rather than the compiler.

Forcing PY_FORMAT_SIZE_T to be "l" instead of "z" fixes this problem.

BTW, this is the same issue on Mac OS X:

>>> struct.pack('=b', -599999)
__main__:1: DeprecationWarning: 'b' format requires 4294967168 <= number <= 127


More information about the Python-Dev mailing list