hex/oct constants > sys.maxint will return positive values in Python 2.4 and up

Fredrik Lundh fredrik at pythonware.com
Wed Nov 6 14:26:59 EST 2002


Jon Ribbens wrote:

> My jonpy modules are producing the following warning when compiled
> under Python 2.3 (current cvs):
>
>   FutureWarning: hex/oct constants > sys.maxint will return positive
>   values in Python 2.4 and up
>
> The offending line of code is as follows:
>
>   data = struct.pack("!I", len(nameval[0]) | 0x80000000)
>
> As far as I can tell, this change, when it comes in, will make no
> difference at all to the way this code works. Am I right? What am
> I supposed to do to make the warning go away? Rewrite 0x80000000 as
> 0x40000000 * 2 ? ;-)

add the sign?

or disable the warning?  (see docs for the warning module)

the answer might be hidden somewhere in here, but I'm not
sure (we're at transition phase B0, I think):

    http://www.python.org/peps/pep-0237.html

</F>





More information about the Python-list mailing list