How to get rid of "hex/oct constants > sys.maxint" warning?

Christopher T King squirrel at WPI.EDU
Wed Aug 11 11:31:47 EDT 2004


On 11 Aug 2004, Grant Edwards wrote:

> How _do_ I get rid of the warning?  Is there a way to tell
> Python that the constant isn't an integer, it's just a bit
> pattern?

The best way is to tell Python to silence the warning:

>>> 0xc0047a80
FutureWarning
>>> import warnings
>>> warnings.simplefilter('ignore',FutureWarning)
>>> 0xc0047a80
-1073448320

fcntl() doesn't really care what it gets, so long as it can convert it to 
a 32-bit value, something it can't do with a long integer.  In 2.3, 
0xc0047a80 returns a negative integer, which is acceptable to fcntl().  In 
2.4, it's going to return a long integer -- presumably fcntl() will also 
be able to accept long integers.




More information about the Python-list mailing list