[Python-checkins] r41972 - python/branches/ssize_t/Objects/funcobject.c

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 8 10:46:52 CET 2006


neal.norwitz wrote:
>  		PyErr_Format(PyExc_ValueError,
> -			     "%s() requires a code object with %d free vars,"
> -			     " not %d",
> +			     "%s() requires a code object with %ld free vars,"
> +			     " not %ld",
>  			     PyString_AsString(op->func_name),
>  			     nclosure, nfree);

I'm not sure whether this is the right fix. This says nclosure and nfree
are longs; this is true on most 32-bit systems (where ssize_t is int
and int and long have the same width), and on some 64-bit systems (where
ssize_t and long are the same). It does not work for Win64 (where
ssize_t is larger than long).

I'm tempted to use %zd in these places, but fear that it isn't portable
enough (it *is* part of C99).

Regards,
Martin


More information about the Python-checkins mailing list