|
This section lists previously described changes that may require changes to your code:
- yield is now always a keyword; if it's used as a variable
name in your code, a different name must be chosen.
- For strings X and Y,
X in Y
now works if X is more than one character long.
- The int() type constructor will now return a long integer
instead of raising an OverflowError when a string or
floating-point number is too large to fit into an integer.
- If you have Unicode strings that contain 8-bit characters, you must declare the
file's encoding (UTF-8, Latin-1, or whatever) by adding a comment to the top of the
file. See section 3 for
more information.
- Calling Tcl methods through _tkinter no longer returns only
strings. Instead, if Tcl returns other objects those objects are converted to their
Python equivalent, if one exists, or wrapped with a _tkinter.Tcl_Obj
object if no Python equivalent exists.
- Large octal and hex literals such as
0xffffffff now trigger a 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.
There are a few ways to fix this warning. If you really need a positive number,
just add an "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 (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 0xffffffffL &~(1L«31).
- You can no longer disable assertions by assigning to
__debug__.
- The Distutils setup() function has gained various new
keyword arguments such as depends. Old versions of the Distutils will abort
if passed unknown keywords. A solution is to check for the presence of the new get_distutil_options() function in your setup.py
and only uses the new keywords with a version of the Distutils that supports them:
from distutils import core
kw = {'sources': 'foo.c', ...}
if hasattr(core, 'get_distutil_options'):
kw['depends'] = ['foo.h']
ext = Extension(**kw)
- Using
None as a variable name will now result in a SyntaxWarning warning.
- Names of extension types defined by the modules included with Python now contain the
module and a "." in front of the type name.
|