[Python-Dev] int/long FutureWarning
Guido van Rossum
Wed, 27 Nov 2002 20:07:21 -0500
> "Mark Hammond" <email@example.com> writes:
> > Any suggestions for me?
> There is no solution to this problem yet. If you add an L to the
> constant (or if it becomes positive in Python 2.4), you can't pass it
> to the "i" format to anymore, as it will cause an OverflowError.
> Suppressing the warning now will only defer the problem to the future.
But in Mark's case (and in many other cases) there will be no problem
in the future -- in Python 2.4, his C code will happily accept the
positive Python longs that 0x80000000 and others will be then.
I wonder if perhaps the warnings for hex/oct constants aren't so
important, and we should use PendingDeprecationWarning or some similar
warning that's not normally printed? They sure are a pest!
BTW, this reminds me that I've long promised a set of new format codes
for PyArg_ParseTuple() to specify taking the lower N bits (for N in
8, 16, 32, 64) and throwing the rest away, without range checks. If
someone else can get to this first, that would be great -- I can't
seem to make time for this, even though it is still my utmost desire
and plan to have a 2.3a1 release ready before Xmas.
--Guido van Rossum (home page: http://www.python.org/~guido/)