Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72df65a

Browse files
committed
Add Neil's suggestions for avoiding this warning
1 parent 2c646c9 commit 72df65a

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Doc/whatsnew/whatsnew23.tex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,9 +2076,17 @@ \section{Porting to Python 2.3}
20762076
exists.
20772077

20782078
\item Large octal and hex literals such as
2079-
0xffffffff now trigger a \exception{FutureWarning} because currently
2079+
\code{0xffffffff} now trigger a \exception{FutureWarning}. Currently
20802080
they're stored as 32-bit numbers and result in a negative value, but
2081-
in Python 2.4 they'll become positive long integers.
2081+
in Python 2.4 they'll become positive long integers.
2082+
2083+
There are a few ways to fix this warning. If you really need a
2084+
positive number, just add an \samp{L} to the end of the literal. If
2085+
you're trying to get a 32-bit integer with low bits set and have
2086+
previously used an expression such as \code{~(1 << 31)}, it's probably
2087+
clearest to start with all bits set and clear the desired upper bits.
2088+
For example, to clear just the top bit (bit 31), you could write
2089+
\code{0xffffffffL {\&}{\textasciitilde}(1L<<31)}.
20822090

20832091
\item You can no longer disable assertions by assigning to \code{__debug__}.
20842092

0 commit comments

Comments
 (0)