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

Martin v. Loewis martin at v.loewis.de
Wed Nov 6 18:11:58 EST 2002


Jon Ribbens <jon+usenet at unequivocal.co.uk> writes:

> 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 ? ;-)

If you think it makes no difference, add an L to the constant: it will
be a long int when the change is implemented (unless you are using
64-bit systems by then).

Regards,
Martin



More information about the Python-list mailing list