[Python-Dev] int/long FutureWarning

Martin v. L÷wis martin@v.loewis.de
29 Nov 2002 00:41:40 +0100


"Mark Hammond" <mhammond@skippinet.com.au> writes:

> Except, on the flip-side, let's say I am *happy* for such contants to become
> longs.  I really don't want to see the warning for every hex literal once I
> understand the impact.

Reducing the warnings to one warning per module might be reasonable.

To silence the warning, you should really add "L" suffixes to all
those literals - or we could provide a future statement, where you
indicate that you want those literals to become positive longs *now*;
you'ld need to add this statement once per module.

However, when you do that, I believe you will get OverflowErrors
once you pass the constants to your C API.

> So, maybe we simply need finer-grained warnings - such as in
> PyArg_ParseTuple, and any other places where the impact will
> actually be felt.

Feel free to propose specific patches. I believe this specific
strategy is unimplementable: When the value goes to ParseTuple, it is
not known anymore whether the integer literal was hex (or whether
there was any integer literal at all).

Regards,
Martin