[Python-Dev] 2.1c1: test_format failing?

Tim Peters tim.one@home.com
Thu, 12 Apr 2001 21:17:09 -0400


[Mark Favas]
> A couple of additions to test_format.py between April 12 and 13 now
> cause the test to fail on Tru64 Unix (with Compaq's C compiler). Has
> anyone else noticed errors with the test? The failures when runnin
> the test standalone are:
>
> '%#o' % 0 =? '0' ... no
> u'%#o' % 0 =? '0' ... no
> ...
> But instead we got: "'%#o' % 0 == '00' != '0'"

Please run this C program:

#include <stdio.h>
void main() {
    printf("%#o\n", 0);
}

Does it print 00?  It *should* print 0:

    # The result is converted to an ‘‘alternative form’’. For
      o conversion, it increases the precision, if and only if
      necessary, to force the first digit of the result to be a
      zero (if the value and precision are both 0, a single 0 is
      printed). ...

In the test program, the value and precision are both 0, so a single '0' must
be the result (else your platform C is buggy).

Please let us know what happens.  Does anyone else get 00 from the above?