FutureWarning question
John Roth
newsgroups at jhrothjr.com
Tue Apr 13 09:40:03 EDT 2004
"Mike" <mike at nospam.com> wrote in message
news:16mnetilcmds6.1apnyu46tbjpw.dlg at 40tude.net...
> I ran across the message below in 2.3.2 today. These are the lines of
code:
>
> 402: if m1_hi >> 15 & 0x0001 == 1:
> 403: m1_hi = m1_hi | 0xFFFF0000
> 404: if m1_lo >> 15 & 0x0001 == 1:
> 405: m1_lo = m1_lo | 0xFFFF0000
>
> This is the warning message:
>
> pwg.py:403: FutureWarning: hex/oct constants > sys.maxint will return
> positive values in Python 2.4 and up
> m1_hi = m1_hi | 0xFFFF0000
> pwg.py:405: FutureWarning: hex/oct constants > sys.maxint will return
> positive values in Python 2.4 and up
> m1_lo = m1_lo | 0xFFFF0000
>
> m1_hi and m1_lo are 32 bit values read from a file. It's not clear to me
> what the warning message means. The only constant is 0xffff0000; does the
> message mean that the result of the OR operation won't be what I think it
> is? Can anyone elucidate?
It doesn't have anything to do with bitwise operations. What it has to
do with is that 0xFFFF0000 is a negative number today, and it
will be a positive number in 2.4 As far as I can tell, the bitwise
operations are not affected. See PEP 237
(http://www.python.org/peps/pep-0237.html) for the explanation.
John Roth
>
> Thanks,
>
> -- Mike --
More information about the Python-list
mailing list