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

Neal Norwitz nnorwitz at gmail.com
Fri Sep 22 07:23:54 CEST 2006

On 9/21/06, Jack Diederich <jackdied at jackdied.com> wrote:
> I should leave the tounge-in-cheek bombast to Tim and Frederik, especially
> when dealing with what might be an OS & machine specific bug.  The next
> checkin and re-test will or won't highlight a failure and certainly someone
> with a g4 will try it out before 2.5.1 goes out so we'll know if it was a
> fluke soonish. The original error was mine, I typed "Size_t" instead of
> "Ssize_t" and while my one-char patch might also be wrong (I hope not, I'm
> red-faced enough as is) we should find out soon enough.

It looks like %zd of a negative number is treated as an unsigned
number on OS X, even though the man page says it should be signed.

The z modifier, when applied to a d or i conversion, indicates that
the argument is of a signed type equivalent in size to a size_t.

The program below returns -123 on Linux and 4294967173 on OS X.

#include <stdio.h>
int main()
    char buffer[256];
      if(sprintf(buffer, "%zd", (size_t)-123) < 0)
        return 1;
     printf("%s\n", buffer);
     return 0;

More information about the Python-Dev mailing list