[Python-Dev] test_builtin failing? or just 64-bit platforms

Tim Peters tim.one@home.com
Fri, 30 Nov 2001 23:31:51 -0500

> ...
> Heh, I was going to suggest that this might be a good place to
> substitute a call to PyString_FromFormat*() but then I read this
> little nugget:
> 			case 'd': case 'i': case 'x':
> 				(void) va_arg(count, int);
> 				/* 20 bytes should be enough to
> hold a 64-bit
> 				   integer */
> 				n += 20;
> 				break;

This use of 20 is fine (I checked all occurrences of "20" in the codebase,
BTW); int_repr's use of 20 was wrong because it failed to allow for the
trailing \0 byte too; the loop in PyString_FromFormatV doesn't have to worry
about that (PyString_FromStringAndSize() later adds 1 of its own for the
trailing \0 -- of course it doesn't actually add anything, but it adds 1 "in
effect" <wink -- jeez, C string handling is obscure!>).