]> granicus.if.org Git - python/commitdiff
Add Neil's suggestions for avoiding this warning
authorAndrew M. Kuchling <amk@amk.ca>
Mon, 10 Feb 2003 15:08:16 +0000 (15:08 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Mon, 10 Feb 2003 15:08:16 +0000 (15:08 +0000)
Doc/whatsnew/whatsnew23.tex

index 941f4aab74944ccf05317b6bd44e17236e87635c..6d75de21088d218552a96565843eb7c119b7c6a8 100644 (file)
@@ -2076,9 +2076,17 @@ wrapped with a \class{_tkinter.Tcl_Obj} object if no Python equivalent
 exists.
 
 \item Large octal and hex literals such as
-0xffffffff now trigger a \exception{FutureWarning} because currently
+\code{0xffffffff} now trigger a \exception{FutureWarning}. Currently
 they're stored as 32-bit numbers and result in a negative value, but
-in Python 2.4 they'll become positive long integers.  
+in Python 2.4 they'll become positive long integers. 
+
+There are a few ways to fix this warning.  If you really need a
+positive number, just add an \samp{L} to the end of the literal.  If
+you're trying to get a 32-bit integer with low bits set and have
+previously used an expression such as \code{~(1 << 31)}, it's probably
+clearest to start with all bits set and clear the desired upper bits.
+For example, to clear just the top bit (bit 31), you could write
+\code{0xffffffffL {\&}{\textasciitilde}(1L<<31)}.
 
 \item You can no longer disable assertions by assigning to \code{__debug__}.