2001-01-24 23:36:26 -04:00
|
|
|
What's New in Python 2.1 alpha 2?
|
|
|
|
=================================
|
2001-01-27 01:35:26 -04:00
|
|
|
|
2001-01-24 23:36:26 -04:00
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
2001-02-01 16:38:45 -04:00
|
|
|
- Scopes nest. If a name is used in a function or class, but is not
|
|
|
|
local, the definition in the nearest enclosing function scope will
|
|
|
|
be used. One consequence of this change is that lambda statements
|
|
|
|
could reference variables in the namespaces where the lambda is
|
|
|
|
defined. In some unusual cases, this change will break code.
|
|
|
|
|
|
|
|
In all previous version of Python, names were resolved in exactly
|
|
|
|
three namespaces -- the local namespace, the global namespace, and
|
2001-02-02 16:06:28 -04:00
|
|
|
the builtin namespace. According to this old definition, if a
|
2001-02-01 16:38:45 -04:00
|
|
|
function A is defined within a function B, the names bound in B are
|
|
|
|
not visible in A. The new rules make names bound in B visible in A,
|
|
|
|
unless A contains a name binding that hides the binding in B.
|
|
|
|
|
|
|
|
Section 4.1 of the reference manual describes the new scoping rules
|
|
|
|
in detail. The test script in Lib/test/test_scope.py demonstrates
|
|
|
|
some of the effects of the change.
|
|
|
|
|
|
|
|
The new rules will cause existing code to break if it defines nested
|
|
|
|
functions where an outer function has local variables with the same
|
|
|
|
name as globals or builtins used by the inner function. Example:
|
|
|
|
|
|
|
|
def munge(str):
|
|
|
|
def helper(x):
|
|
|
|
return str(x)
|
|
|
|
if type(str) != type(''):
|
|
|
|
str = helper(str)
|
|
|
|
return str.strip()
|
|
|
|
|
|
|
|
Under the old rules, the name str in helper() is bound to the
|
|
|
|
builtin function str(). Under the new rules, it will be bound to
|
|
|
|
the argument named str and an error will occur when helper() is
|
|
|
|
called.
|
|
|
|
|
2001-02-02 16:06:28 -04:00
|
|
|
- The compiler will report a SyntaxError if "from ... import *" occurs
|
|
|
|
in a function or class scope. The language reference has documented
|
|
|
|
that this case is illegal, but the compiler never checked for it.
|
|
|
|
The recent introduction of nested scope makes the meaning of this
|
|
|
|
form of name binding ambiguous. In a future release, the compiler
|
|
|
|
may allow this form when there is no possibility of ambiguity.
|
|
|
|
|
2001-01-27 01:35:26 -04:00
|
|
|
- repr(string) is easier to read, now using hex escapes instead of octal,
|
|
|
|
and using \t, \n and \r instead of \011, \012 and \015 (respectively):
|
|
|
|
|
|
|
|
>>> "\texample \r\n" + chr(0) + chr(255)
|
|
|
|
'\texample \r\n\x00\xff' # in 2.1
|
|
|
|
'\011example \015\012\000\377' # in 2.0
|
|
|
|
|
2001-01-29 02:41:00 -04:00
|
|
|
- Functions are now compared and hashed by identity, not by value, since
|
|
|
|
the func_code attribute is writable.
|
|
|
|
|
2001-02-01 16:00:40 -04:00
|
|
|
- Weak references (PEP 205) have been added. This involves a few
|
|
|
|
changes in the core, an extension module (_weakref), and a Python
|
|
|
|
module (weakref). The weakref module is the public interface. It
|
|
|
|
includes support for "explicit" weak references, proxy objects, and
|
|
|
|
mappings with weakly held values.
|
|
|
|
|
2001-02-01 18:53:15 -04:00
|
|
|
- A 'continue' statement can now appear in a try block within the body
|
|
|
|
of a loop. It is still not possible to use continue in a finally
|
2001-02-02 01:57:15 -04:00
|
|
|
clause.
|
2001-02-01 18:53:15 -04:00
|
|
|
|
2001-01-24 23:36:26 -04:00
|
|
|
Standard library
|
|
|
|
|
2001-01-31 18:14:01 -04:00
|
|
|
- mailbox.py now has a new class, PortableUnixMailbox which is
|
|
|
|
identical to UnixMailbox but uses a more portable scheme for
|
|
|
|
determining From_ separators. Also, the constructors for all the
|
|
|
|
classes in this module have a new optional `factory' argument, which
|
|
|
|
is a callable used when new message classes must be instantiated by
|
|
|
|
the next() method.
|
|
|
|
|
2001-01-24 23:36:26 -04:00
|
|
|
- random.py is now self-contained, and offers all the functionality of
|
|
|
|
the now-deprecated whrandom.py. See the docs for details. random.py
|
|
|
|
also supports new functions getstate() and setstate(), for saving
|
2001-01-25 02:23:18 -04:00
|
|
|
and restoring the internal state of the generator; and jumpahead(n),
|
|
|
|
for quickly forcing the internal state to be the same as if n calls to
|
|
|
|
random() had been made. The latter is particularly useful for multi-
|
|
|
|
threaded programs, creating one instance of the random.Random() class for
|
|
|
|
each thread, then using .jumpahead() to force each instance to use a
|
|
|
|
non-overlapping segment of the full period.
|
2001-01-24 23:36:26 -04:00
|
|
|
|
2001-02-01 00:59:18 -04:00
|
|
|
- random.py's seed() function is new. For bit-for-bit compatibility with
|
|
|
|
prior releases, use the whseed function instead. The new seed function
|
|
|
|
addresses two problems: (1) The old function couldn't produce more than
|
|
|
|
about 2**24 distinct internal states; the new one about 2**45 (the best
|
|
|
|
that can be done in the Wichmann-Hill generator). (2) The old function
|
|
|
|
sometimes produced identical internal states when passed distinct
|
|
|
|
integers, and there was no simple way to predict when that would happen;
|
|
|
|
the new one guarantees to produce distinct internal states for all
|
|
|
|
arguments in [0, 27814431486576L).
|
|
|
|
|
2001-02-01 23:29:24 -04:00
|
|
|
- The socket module now supports raw packets on Linux. The socket
|
|
|
|
family is AF_PACKET.
|
|
|
|
|
2001-02-02 01:57:15 -04:00
|
|
|
- test_capi.py is a start at running tests of the Python C API. The tests
|
|
|
|
are implemented by the new Modules/_testmodule.c.
|
|
|
|
|
2001-02-02 16:06:28 -04:00
|
|
|
- A new extension module, _symtable, provides provisional access to the
|
|
|
|
internal symbol table used by the Python compiler. A higher-level
|
|
|
|
interface will be added on top of _symtable in a future release.
|
|
|
|
|
2001-01-31 15:39:44 -04:00
|
|
|
Windows changes
|
|
|
|
|
|
|
|
- Build procedure: the zlib project is built in a different way that
|
|
|
|
ensures the zlib header files used can no longer get out of synch with
|
2001-02-02 01:57:15 -04:00
|
|
|
the zlib binary used. See PCbuild\readme.txt for details. Your old
|
|
|
|
zlib-related directories can be deleted; you'll need to download fresh
|
|
|
|
source for zlib and unpack it into a new directory.
|
|
|
|
|
|
|
|
- Build: New subproject _test for the benefit of test_capi.py (see above).
|
2001-01-31 15:39:44 -04:00
|
|
|
|
2001-02-02 01:57:15 -04:00
|
|
|
- Build: subproject ucnhash is gone, since the code was folded into the
|
|
|
|
unicodedata subproject.
|
2001-01-24 23:36:26 -04:00
|
|
|
|
2000-11-30 01:22:44 -04:00
|
|
|
What's New in Python 2.1 alpha 1?
|
|
|
|
=================================
|
|
|
|
|
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
2001-01-20 06:34:52 -04:00
|
|
|
- There is a new Unicode companion to the PyObject_Str() API
|
|
|
|
called PyObject_Unicode(). It behaves in the same way as the
|
|
|
|
former, but assures that the returned value is an Unicode object
|
|
|
|
(applying the usual coercion if necessary).
|
2001-01-17 13:09:53 -04:00
|
|
|
|
2001-01-17 11:54:45 -04:00
|
|
|
- The comparison operators support "rich comparison overloading" (PEP
|
|
|
|
207). C extension types can provide a rich comparison function in
|
|
|
|
the new tp_richcompare slot in the type object. The cmp() function
|
|
|
|
and the C function PyObject_Compare() first try the new rich
|
|
|
|
comparison operators before trying the old 3-way comparison. There
|
|
|
|
is also a new C API PyObject_RichCompare() (which also falls back on
|
|
|
|
the old 3-way comparison, but does not constrain the outcome of the
|
|
|
|
rich comparison to a Boolean result).
|
|
|
|
|
|
|
|
The rich comparison function takes two objects (at least one of
|
|
|
|
which is guaranteed to have the type that provided the function) and
|
|
|
|
an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
|
|
|
|
Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
|
|
|
|
object, which may be NotImplemented (in which case the tp_compare
|
|
|
|
slot function is used as a fallback, if defined).
|
|
|
|
|
|
|
|
Classes can overload individual comparison operators by defining one
|
|
|
|
or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
|
2001-01-18 10:28:08 -04:00
|
|
|
__ge__. There are no explicit "reflected argument" versions of
|
|
|
|
these; instead, __lt__ and __gt__ are each other's reflection,
|
|
|
|
likewise for__le__ and __ge__; __eq__ and __ne__ are their own
|
|
|
|
reflection (similar at the C level). No other implications are
|
|
|
|
made; in particular, Python does not assume that == is the Boolean
|
|
|
|
inverse of !=, or that < is the Boolean inverse of >=. This makes
|
|
|
|
it possible to define types with partial orderings.
|
2001-01-17 11:54:45 -04:00
|
|
|
|
|
|
|
Classes or types that want to implement (in)equality tests but not
|
|
|
|
the ordering operators (i.e. unordered types) should implement ==
|
|
|
|
and !=, and raise an error for the ordering operators.
|
|
|
|
|
2001-01-18 10:28:08 -04:00
|
|
|
It is possible to define types whose rich comparison results are not
|
2001-01-17 11:54:45 -04:00
|
|
|
Boolean; e.g. a matrix type might want to return a matrix of bits
|
|
|
|
for A < B, giving elementwise comparisons. Such types should ensure
|
|
|
|
that any interpretation of their value in a Boolean context raises
|
|
|
|
an exception, e.g. by defining __nonzero__ (or the tp_nonzero slot
|
|
|
|
at the C level) to always raise an exception.
|
|
|
|
|
2001-01-18 10:28:08 -04:00
|
|
|
- Complex numbers use rich comparisons to define == and != but raise
|
|
|
|
an exception for <, <=, > and >=. Unfortunately, this also means
|
|
|
|
that cmp() of two complex numbers raises an exception when the two
|
|
|
|
numbers differ. Since it is not mathematically meaningful to compare
|
|
|
|
complex numbers except for equality, I hope that this doesn't break
|
|
|
|
too much code.
|
|
|
|
|
2001-01-15 16:43:18 -04:00
|
|
|
- Functions and methods now support getting and setting arbitrarily
|
|
|
|
named attributes (PEP 232). Functions have a new __dict__
|
|
|
|
(a.k.a. func_dict) which hold the function attributes. Methods get
|
|
|
|
and set attributes on their underlying im_func. It is a TypeError
|
|
|
|
to set an attribute on a bound method.
|
|
|
|
|
2001-01-15 15:11:10 -04:00
|
|
|
- The xrange() object implementation has been improved so that
|
|
|
|
xrange(sys.maxint) can be used on 64-bit platforms. There's still a
|
|
|
|
limitation that in this case len(xrange(sys.maxint)) can't be
|
|
|
|
calculated, but the common idiom "for i in xrange(sys.maxint)" will
|
|
|
|
work fine as long as the index i doesn't actually reach 2**31.
|
|
|
|
(Python uses regular ints for sequence and string indices; fixing
|
|
|
|
that is much more work.)
|
|
|
|
|
2001-01-12 12:25:08 -04:00
|
|
|
- Two changes to from...import:
|
|
|
|
|
|
|
|
1) "from M import X" now works even if M is not a real module; it's
|
|
|
|
basically a getattr() operation with AttributeError exceptions
|
|
|
|
changed into ImportError.
|
|
|
|
|
|
|
|
2) "from M import *" now looks for M.__all__ to decide which names to
|
|
|
|
import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but
|
|
|
|
filters out names starting with '_' as before. Whether or not
|
|
|
|
__all__ exists, there's no restriction on the type of M.
|
|
|
|
|
2001-01-10 16:13:55 -04:00
|
|
|
- File objects have a new method, xreadlines(). This is the fastest
|
|
|
|
way to iterate over all lines in a file:
|
|
|
|
|
|
|
|
for line in file.xreadlines():
|
|
|
|
...do something to line...
|
|
|
|
|
|
|
|
See the xreadlines module (mentioned below) for how to do this for
|
|
|
|
other file-like objects.
|
|
|
|
|
|
|
|
- Even if you don't use file.xreadlines(), you may expect a speedup on
|
|
|
|
line-by-line input. The file.readline() method has been optimized
|
2001-01-15 02:33:19 -04:00
|
|
|
quite a bit in platform-specific ways: on systems (like Linux) that
|
|
|
|
support flockfile(), getc_unlocked(), and funlockfile(), those are
|
|
|
|
used by default. On systems (like Windows) without getc_unlocked(),
|
|
|
|
a complicated (but still thread-safe) method using fgets() is used by
|
|
|
|
default.
|
|
|
|
|
2001-01-25 02:23:18 -04:00
|
|
|
You can force use of the fgets() method by #define'ing
|
|
|
|
USE_FGETS_IN_GETLINE at build time (it may be faster than
|
2001-01-15 02:33:19 -04:00
|
|
|
getc_unlocked()).
|
|
|
|
|
2001-01-25 02:23:18 -04:00
|
|
|
You can force fgets() not to be used by #define'ing
|
|
|
|
DONT_USE_FGETS_IN_GETLINE (this is the first thing to try if std test
|
2001-01-15 02:33:19 -04:00
|
|
|
test_bufio.py fails -- and let us know if it does!).
|
|
|
|
|
|
|
|
- In addition, the fileinput module, while still slower than the other
|
|
|
|
methods on most platforms, has been sped up too, by using
|
|
|
|
file.readlines(sizehint).
|
2001-01-10 16:13:55 -04:00
|
|
|
|
|
|
|
- Support for run-time warnings has been added, including a new
|
|
|
|
command line option (-W) to specify the disposition of warnings.
|
|
|
|
See the description of the warnings module below.
|
|
|
|
|
|
|
|
- Extensive changes have been made to the coercion code. This mostly
|
|
|
|
affects extension modules (which can now implement mixed-type
|
|
|
|
numerical operators without having to use coercion), but
|
|
|
|
occasionally, in boundary cases the coercion semantics have changed
|
|
|
|
subtly. Since this was a terrible gray area of the language, this
|
2001-01-11 11:00:14 -04:00
|
|
|
is considered an improvement. Also note that __rcmp__ is no longer
|
2001-01-10 16:13:55 -04:00
|
|
|
supported -- instead of calling __rcmp__, __cmp__ is called with
|
2001-01-18 10:28:08 -04:00
|
|
|
reflected arguments.
|
2001-01-10 16:13:55 -04:00
|
|
|
|
2001-01-17 11:54:45 -04:00
|
|
|
- In connection with the coercion changes, a new built-in singleton
|
|
|
|
object, NotImplemented is defined. This can be returned for
|
|
|
|
operations that wish to indicate they are not implemented for a
|
|
|
|
particular combination of arguments. From C, this is
|
|
|
|
Py_NotImplemented.
|
|
|
|
|
2001-01-04 16:30:56 -04:00
|
|
|
- The interpreter accepts now bytecode files on the command line even
|
|
|
|
if they do not have a .pyc or .pyo extension. On Linux, after executing
|
|
|
|
|
|
|
|
echo ':pyc:M::\x87\xc6\x0d\x0a::/usr/local/bin/python:' > /proc/sys/fs/binfmt_misc/register
|
|
|
|
|
|
|
|
any byte code file can be used as an executable (i.e. as an argument
|
|
|
|
to execve(2)).
|
|
|
|
|
2000-12-01 03:59:35 -04:00
|
|
|
- %[xXo] formats of negative Python longs now produce a sign
|
2000-11-30 01:22:44 -04:00
|
|
|
character. In 1.6 and earlier, they never produced a sign,
|
|
|
|
and raised an error if the value of the long was too large
|
|
|
|
to fit in a Python int. In 2.0, they produced a sign if and
|
|
|
|
only if too large to fit in an int. This was inconsistent
|
|
|
|
across platforms (because the size of an int varies across
|
|
|
|
platforms), and inconsistent with hex() and oct(). Example:
|
|
|
|
|
|
|
|
>>> "%x" % -0x42L
|
2000-12-01 03:59:35 -04:00
|
|
|
'-42' # in 2.1
|
2000-11-30 01:22:44 -04:00
|
|
|
'ffffffbe' # in 2.0 and before, on 32-bit machines
|
|
|
|
>>> hex(-0x42L)
|
|
|
|
'-0x42L' # in all versions of Python
|
|
|
|
|
2000-12-01 03:59:35 -04:00
|
|
|
The behavior of %d formats for negative Python longs remains
|
|
|
|
the same as in 2.0 (although in 1.6 and before, they raised
|
|
|
|
an error if the long didn't fit in a Python int).
|
|
|
|
|
|
|
|
%u formats don't make sense for Python longs, but are allowed
|
|
|
|
and treated the same as %d in 2.1. In 2.0, a negative long
|
|
|
|
formatted via %u produced a sign if and only if too large to
|
|
|
|
fit in an int. In 1.6 and earlier, a negative long formatted
|
|
|
|
via %u raised an error if it was too big to fit in an int.
|
|
|
|
|
2000-12-12 18:10:31 -04:00
|
|
|
- Dictionary objects have an odd new method, popitem(). This removes
|
|
|
|
an arbitrary item from the dictionary and returns it (in the form of
|
|
|
|
a (key, value) pair). This can be useful for algorithms that use a
|
|
|
|
dictionary as a bag of "to do" items and repeatedly need to pick one
|
|
|
|
item. Such algorithms normally end up running in quadratic time;
|
|
|
|
using popitem() they can usually be made to run in linear time.
|
|
|
|
|
2000-12-28 22:06:45 -04:00
|
|
|
Standard library
|
|
|
|
|
2001-01-19 19:16:56 -04:00
|
|
|
- In the time module, the time argument to the functions strftime,
|
|
|
|
localtime, gmtime, asctime and ctime is now optional, defaulting to
|
|
|
|
the current time (in the local timezone).
|
|
|
|
|
2001-01-15 12:36:08 -04:00
|
|
|
- The ftplib module now defaults to passive mode, which is deemed a
|
|
|
|
more useful default given that clients are often inside firewalls
|
|
|
|
these days. Note that this could break if ftplib is used to connect
|
|
|
|
to a *server* that is inside a firewall, from outside; this is
|
|
|
|
expected to be a very rare situation. To fix that, you can call
|
|
|
|
ftp.set_pasv(0).
|
|
|
|
|
2001-01-13 05:54:41 -04:00
|
|
|
- The module site now treats .pth files not only for path configuration,
|
|
|
|
but also supports extensions to the initialization code: Lines starting
|
|
|
|
with import are executed.
|
|
|
|
|
2001-01-10 16:13:55 -04:00
|
|
|
- There's a new module, warnings, which implements a mechanism for
|
|
|
|
issuing and filtering warnings. There are some new built-in
|
|
|
|
exceptions that serve as warning categories, and a new command line
|
|
|
|
option, -W, to control warnings (e.g. -Wi ignores all warnings, -We
|
|
|
|
turns warnings into errors). warnings.warn(message[, category])
|
|
|
|
issues a warning message; this can also be called from C as
|
|
|
|
PyErr_Warn(category, message).
|
|
|
|
|
|
|
|
- A new module xreadlines was added. This exports a single factory
|
|
|
|
function, xreadlines(). The intention is that this code is the
|
|
|
|
absolutely fastest way to iterate over all lines in an open
|
|
|
|
file(-like) object:
|
|
|
|
|
|
|
|
import xreadlines
|
|
|
|
for line in xreadlines.xreadlines(file):
|
|
|
|
...do something to line...
|
|
|
|
|
|
|
|
This is equivalent to the previous the speed record holder using
|
|
|
|
file.readlines(sizehint). Note that if file is a real file object
|
|
|
|
(as opposed to a file-like object), this is equivalent:
|
|
|
|
|
|
|
|
for line in file.xreadlines():
|
|
|
|
...do something to line...
|
|
|
|
|
2000-12-28 22:06:45 -04:00
|
|
|
- The bisect module has new functions bisect_left, insort_left,
|
|
|
|
bisect_right and insort_right. The old names bisect and insort
|
|
|
|
are now aliases for bisect_right and insort_right. XXX_right
|
|
|
|
and XXX_left methods differ in what happens when the new element
|
|
|
|
compares equal to one or more elements already in the list: the
|
|
|
|
XXX_left methods insert to the left, the XXX_right methods to the
|
2001-01-05 04:05:32 -04:00
|
|
|
right. Code that doesn't care where equal elements end up should
|
|
|
|
continue to use the old, short names ("bisect" and "insort").
|
2000-12-28 22:06:45 -04:00
|
|
|
|
2001-01-13 10:53:34 -04:00
|
|
|
- The new curses.panel module wraps the panel library that forms part
|
|
|
|
of SYSV curses and ncurses. Contributed by Thomas Gellekum.
|
|
|
|
|
2001-01-10 16:13:55 -04:00
|
|
|
- The SocketServer module now sets the allow_reuse_address flag by
|
|
|
|
default in the TCPServer class.
|
|
|
|
|
|
|
|
- A new function, sys._getframe(), returns the stack frame pointer of
|
|
|
|
the caller. This is intended only as a building block for
|
|
|
|
higher-level mechanisms such as string interpolation.
|
|
|
|
|
|
|
|
Build issues
|
|
|
|
|
2001-01-22 23:17:00 -04:00
|
|
|
- For Unix (and Unix-compatible) builds, configuration and building of
|
|
|
|
extension modules is now greatly automated. Rather than having to
|
|
|
|
edit the Modules/Setup file to indicate which modules should be
|
|
|
|
built and where their include files and libraries are, a
|
|
|
|
distutils-based setup.py script now takes care of building most
|
|
|
|
extension modules. All extension modules built this way are built
|
|
|
|
as shared libraries. Only a few modules that must be linked
|
|
|
|
statically are still listed in the Setup file; you won't need to
|
|
|
|
edit their configuration.
|
|
|
|
|
|
|
|
- Python should now build out of the box on Cygwin. If it doesn't,
|
|
|
|
mail to Jason Tishler (jlt63 at users.sourceforge.net).
|
2001-01-10 16:13:55 -04:00
|
|
|
|
|
|
|
- Python now always uses its own (renamed) implementation of getopt()
|
|
|
|
-- there's too much variation among C library getopt()
|
|
|
|
implementations.
|
|
|
|
|
|
|
|
- C++ compilers are better supported; the CXX macro is always set to a
|
|
|
|
C++ compiler if one is found.
|
2000-12-28 22:06:45 -04:00
|
|
|
|
2000-12-11 21:18:41 -04:00
|
|
|
Windows changes
|
|
|
|
|
|
|
|
- select module: By default under Windows, a select() call
|
|
|
|
can specify no more than 64 sockets. Python now boosts
|
|
|
|
this Microsoft default to 512. If you need even more than
|
|
|
|
that, see the MS docs (you'll need to #define FD_SETSIZE
|
|
|
|
and recompile Python from source).
|
|
|
|
|
2001-01-10 16:13:55 -04:00
|
|
|
- Support for Windows 3.1, DOS and OS/2 is gone. The Lib/dos-8x3
|
|
|
|
subdirectory is no more!
|
|
|
|
|
2000-11-30 01:22:44 -04:00
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
What's New in Python 2.0?
|
2000-10-16 17:27:25 -03:00
|
|
|
=========================
|
1997-08-14 23:50:47 -03:00
|
|
|
|
2000-09-01 19:34:33 -03:00
|
|
|
Below is a list of all relevant changes since release 1.6. Older
|
2000-09-05 01:38:34 -03:00
|
|
|
changes are in the file HISTORY. If you are making the jump directly
|
|
|
|
from Python 1.5.2 to 2.0, make sure to read the section for 1.6 in the
|
|
|
|
HISTORY file! Many important changes listed there.
|
1997-08-14 23:50:47 -03:00
|
|
|
|
2000-09-05 01:38:34 -03:00
|
|
|
Alternatively, a good overview of the changes between 1.5.2 and 2.0 is
|
|
|
|
the document "What's New in Python 2.0" by Kuchling and Moshe Zadka:
|
|
|
|
http://starship.python.net/crew/amk/python/writing/new-python/.
|
1997-10-06 18:04:35 -03:00
|
|
|
|
2000-09-05 01:38:34 -03:00
|
|
|
--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
|
1998-10-17 16:43:13 -03:00
|
|
|
|
|
|
|
======================================================================
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
What's new in 2.0 (since release candidate 1)?
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
Standard library
|
|
|
|
|
|
|
|
- The copy_reg module was modified to clarify its intended use: to
|
|
|
|
register pickle support for extension types, not for classes.
|
|
|
|
pickle() will raise a TypeError if it is passed a class.
|
|
|
|
|
|
|
|
- Fixed a bug in gettext's "normalize and expand" code that prevented
|
|
|
|
it from finding an existing .mo file.
|
|
|
|
|
|
|
|
- Restored support for HTTP/0.9 servers in httplib.
|
|
|
|
|
2000-10-16 17:24:53 -03:00
|
|
|
- The math module was changed to stop raising OverflowError in case of
|
|
|
|
underflow, and return 0 instead in underflow cases. Whether Python
|
|
|
|
used to raise OverflowError in case of underflow was platform-
|
|
|
|
dependent (it did when the platform math library set errno to ERANGE
|
|
|
|
on underflow).
|
2000-10-16 17:08:38 -03:00
|
|
|
|
|
|
|
- Fixed a bug in StringIO that occurred when the file position was not
|
|
|
|
at the end of the file and write() was called with enough data to
|
|
|
|
extend past the end of the file.
|
|
|
|
|
|
|
|
- Fixed a bug that caused Tkinter error messages to get lost on
|
|
|
|
Windows. The bug was fixed by replacing direct use of
|
|
|
|
interp->result with Tcl_GetStringResult(interp).
|
|
|
|
|
|
|
|
- Fixed bug in urllib2 that caused it to fail when it received an HTTP
|
|
|
|
redirect response.
|
|
|
|
|
|
|
|
- Several changes were made to distutils: Some debugging code was
|
|
|
|
removed from util. Fixed the installer used when an external zip
|
|
|
|
program (like WinZip) is not found; the source code for this
|
|
|
|
installer is in Misc/distutils. check_lib() was modified to behave
|
|
|
|
more like AC_CHECK_LIB by add other_libraries() as a parameter. The
|
|
|
|
test for whether installed modules are on sys.path was changed to
|
|
|
|
use both normcase() and normpath().
|
|
|
|
|
2000-10-16 17:41:38 -03:00
|
|
|
- Several minor bugs were fixed in the xml package (the minidom,
|
|
|
|
pulldom, expatreader, and saxutils modules).
|
2000-10-16 17:08:38 -03:00
|
|
|
|
|
|
|
- The regression test driver (regrtest.py) behavior when invoked with
|
|
|
|
-l changed: It now reports a count of objects that are recognized as
|
|
|
|
garbage but not freed by the garbage collector.
|
|
|
|
|
2000-10-16 17:24:53 -03:00
|
|
|
- The regression test for the math module was changed to test
|
|
|
|
exceptional behavior when the test is run in verbose mode. Python
|
|
|
|
cannot yet guarantee consistent exception behavior across platforms,
|
|
|
|
so the exception part of test_math is run only in verbose mode, and
|
|
|
|
may fail on your platform.
|
2000-10-16 17:08:38 -03:00
|
|
|
|
|
|
|
Internals
|
|
|
|
|
|
|
|
- PyOS_CheckStack() has been disabled on Win64, where it caused
|
|
|
|
test_sre to fail.
|
|
|
|
|
|
|
|
Build issues
|
|
|
|
|
|
|
|
- Changed compiler flags, so that gcc is always invoked with -Wall and
|
|
|
|
-Wstrict-prototypes. Users compiling Python with GCC should see
|
|
|
|
exactly one warning, except if they have passed configure the
|
2000-10-16 17:24:53 -03:00
|
|
|
--with-pydebug flag. The expected warning is for getopt() in
|
2000-10-16 17:51:33 -03:00
|
|
|
Modules/main.c. This warning will be fixed for Python 2.1.
|
2000-10-16 17:08:38 -03:00
|
|
|
|
2000-11-30 01:22:44 -04:00
|
|
|
- Fixed configure to add -threads argument during linking on OSF1.
|
2000-10-16 17:08:38 -03:00
|
|
|
|
|
|
|
Tools and other miscellany
|
|
|
|
|
|
|
|
- The compiler in Tools/compiler was updated to support the new
|
|
|
|
language features introduced in 2.0: extended print statement, list
|
|
|
|
comprehensions, and augmented assignments. The new compiler should
|
|
|
|
also be backwards compatible with Python 1.5.2; the compiler will
|
|
|
|
always generate code for the version of the interpreter it runs
|
2000-11-30 01:22:44 -04:00
|
|
|
under.
|
2000-10-16 17:08:38 -03:00
|
|
|
|
2000-10-09 15:26:42 -03:00
|
|
|
What's new in 2.0 release candidate 1 (since beta 2)?
|
|
|
|
=====================================================
|
|
|
|
|
2000-10-09 18:27:22 -03:00
|
|
|
What is release candidate 1?
|
|
|
|
|
|
|
|
We believe that release candidate 1 will fix all known bugs that we
|
|
|
|
intend to fix for the 2.0 final release. This release should be a bit
|
|
|
|
more stable than the previous betas. We would like to see even more
|
|
|
|
widespread testing before the final release, so we are producing this
|
|
|
|
release candidate. The final release will be exactly the same unless
|
|
|
|
any show-stopping (or brown bag) bugs are found by testers of the
|
|
|
|
release candidate.
|
|
|
|
|
2000-10-09 15:26:42 -03:00
|
|
|
All the changes since the last beta release are bug fixes or changes
|
2000-10-16 17:08:38 -03:00
|
|
|
to support building Python for specific platforms.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
|
|
|
- A bug that caused crashes when __coerce__ was used with augmented
|
|
|
|
assignment, e.g. +=, was fixed.
|
|
|
|
|
|
|
|
- Raise ZeroDivisionError when raising zero to a negative number,
|
|
|
|
e.g. 0.0 ** -2.0. Note that math.pow is unrelated to the builtin
|
|
|
|
power operator and the result of math.pow(0.0, -2.0) will vary by
|
|
|
|
platform. On Linux, it raises a ValueError.
|
|
|
|
|
|
|
|
- A bug in Unicode string interpolation was fixed that occasionally
|
|
|
|
caused errors with formats including "%%". For example, the
|
|
|
|
following expression "%% %s" % u"abc" no longer raises a TypeError.
|
|
|
|
|
|
|
|
- Compilation of deeply nested expressions raises MemoryError instead
|
|
|
|
of SyntaxError, e.g. eval("[" * 50 + "]" * 50).
|
|
|
|
|
|
|
|
- In 2.0b2 on Windows, the interpreter wrote .pyc files in text mode,
|
|
|
|
rendering them useless. They are now written in binary mode again.
|
|
|
|
|
|
|
|
Standard library
|
|
|
|
|
|
|
|
- Keyword arguments are now accepted for most pattern and match object
|
|
|
|
methods in SRE, the standard regular expression engine.
|
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
- In SRE, fixed error with negative lookahead and lookbehind that
|
2000-10-09 16:48:11 -03:00
|
|
|
manifested itself as a runtime error in patterns like "(?<!abc)(def)".
|
2000-10-09 15:26:42 -03:00
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
- Several bugs in the Unicode handling and error handling in _tkinter
|
|
|
|
were fixed.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
- Fix memory management errors in Merge() and Tkapp_Call() routines.
|
|
|
|
|
|
|
|
- Several changes were made to cStringIO to make it compatible with
|
|
|
|
the file-like object interface and with StringIO. If operations are
|
|
|
|
performed on a closed object, an exception is raised. The truncate
|
|
|
|
method now accepts a position argument and readline accepts a size
|
2000-11-30 01:22:44 -04:00
|
|
|
argument.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
- There were many changes made to the linuxaudiodev module and its
|
|
|
|
test suite; as a result, a short, unexpected audio sample should now
|
2000-11-30 01:22:44 -04:00
|
|
|
play when the regression test is run.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
Note that this module is named poorly, because it should work
|
|
|
|
correctly on any platform that supports the Open Sound System
|
2000-11-30 01:22:44 -04:00
|
|
|
(OSS).
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
The module now raises exceptions when errors occur instead of
|
|
|
|
crashing. It also defines the AFMT_A_LAW format (logarithmic A-law
|
|
|
|
audio) and defines a getptr() method that calls the
|
|
|
|
SNDCTL_DSP_GETxPTR ioctl defined in the OSS Programmer's Guide.
|
|
|
|
|
|
|
|
- The library_version attribute, introduced in an earlier beta, was
|
|
|
|
removed because it can not be supported with early versions of the C
|
|
|
|
readline library, which provides no way to determine the version at
|
|
|
|
compile-time.
|
|
|
|
|
|
|
|
- The binascii module is now enabled on Win64.
|
|
|
|
|
2000-10-09 18:19:31 -03:00
|
|
|
- tokenize.py no longer suffers "recursion depth" errors when parsing
|
|
|
|
programs with very long string literals.
|
|
|
|
|
2000-10-09 15:26:42 -03:00
|
|
|
Internals
|
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
- Fixed several buffer overflow vulnerabilities in calculate_path(),
|
2000-10-09 15:26:42 -03:00
|
|
|
which is called when the interpreter starts up to determine where
|
|
|
|
the standard library is installed. These vulnerabilities affect all
|
|
|
|
previous versions of Python and can be exploited by setting very
|
|
|
|
long values for PYTHONHOME or argv[0]. The risk is greatest for a
|
|
|
|
setuid Python script, although use of the wrapper in
|
|
|
|
Misc/setuid-prog.c will eliminate the vulnerability.
|
|
|
|
|
|
|
|
- Fixed garbage collection bugs in instance creation that were
|
|
|
|
triggered when errors occurred during initialization. The solution,
|
|
|
|
applied in cPickle and in PyInstance_New(), is to call
|
|
|
|
PyObject_GC_Init() after the initialization of the object's
|
|
|
|
container attributes is complete.
|
|
|
|
|
|
|
|
- pyexpat adds definitions of PyModule_AddStringConstant and
|
|
|
|
PyModule_AddObject if the Python version is less than 2.0, which
|
|
|
|
provides compatibility with PyXML on Python 1.5.2.
|
|
|
|
|
|
|
|
- If the platform has a bogus definition for LONG_BIT (the number of
|
|
|
|
bits in a long), an error will be reported at compile time.
|
|
|
|
|
|
|
|
- Fix bugs in _PyTuple_Resize() which caused hard-to-interpret garbage
|
|
|
|
collection crashes and possibly other, unreported crashes.
|
|
|
|
|
|
|
|
- Fixed a memory leak in _PyUnicode_Fini().
|
|
|
|
|
|
|
|
Build issues
|
|
|
|
|
|
|
|
- configure now accepts a --with-suffix option that specifies the
|
2000-10-16 17:08:38 -03:00
|
|
|
executable suffix. This is useful for builds on Cygwin and Mac OS
|
2000-11-30 01:22:44 -04:00
|
|
|
X, for example.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
- The mmap.PAGESIZE constant is now initialized using sysconf when
|
|
|
|
possible, which eliminates a dependency on -lucb for Reliant UNIX.
|
|
|
|
|
|
|
|
- The md5 file should now compile on all platforms.
|
|
|
|
|
|
|
|
- The select module now compiles on platforms that do not define
|
|
|
|
POLLRDNORM and related constants.
|
|
|
|
|
|
|
|
- Darwin (Mac OS X): Initial support for static builds on this
|
2000-11-30 01:22:44 -04:00
|
|
|
platform.
|
2000-10-09 15:26:42 -03:00
|
|
|
|
2000-10-09 15:34:12 -03:00
|
|
|
- BeOS: A number of changes were made to the build and installation
|
|
|
|
process. ar-fake now operates on a directory of object files.
|
|
|
|
dl_export.h is gone, and its macros now appear on the mwcc command
|
|
|
|
line during build on PPC BeOS.
|
|
|
|
|
2000-10-16 17:08:38 -03:00
|
|
|
- Platform directory in lib/python2.0 is "plat-beos5" (or
|
2000-10-09 15:34:12 -03:00
|
|
|
"plat-beos4", if building on BeOS 4.5), rather than "plat-beos".
|
2000-10-09 15:26:42 -03:00
|
|
|
|
|
|
|
- Cygwin: Support for shared libraries, Tkinter, and sockets.
|
|
|
|
|
|
|
|
- SunOS 4.1.4_JL: Fix test for directory existence in configure.
|
|
|
|
|
|
|
|
Tools and other miscellany
|
|
|
|
|
|
|
|
- Removed debugging prints from main used with freeze.
|
|
|
|
|
2000-10-09 18:19:31 -03:00
|
|
|
- IDLE auto-indent no longer crashes when it encounters Unicode
|
|
|
|
characters.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
What's new in 2.0 beta 2 (since beta 1)?
|
|
|
|
========================================
|
|
|
|
|
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
2000-09-26 03:33:09 -03:00
|
|
|
- Add support for unbounded ints in %d,i,u,x,X,o formats; for example
|
2000-09-26 08:16:10 -03:00
|
|
|
"%d" % 2L**64 == "18446744073709551616".
|
|
|
|
|
|
|
|
- Add -h and -V command line options to print the usage message and
|
|
|
|
Python version number and exit immediately.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- eval() and exec accept Unicode objects as code parameters.
|
|
|
|
|
|
|
|
- getattr() and setattr() now also accept Unicode objects for the
|
|
|
|
attribute name, which are converted to strings using the default
|
|
|
|
encoding before lookup.
|
|
|
|
|
|
|
|
- Multiplication on string and Unicode now does proper bounds
|
|
|
|
checking; e.g. 'a' * 65536 * 65536 will raise ValueError, "repeated
|
|
|
|
string is too long."
|
|
|
|
|
|
|
|
- Better error message when continue is found in try statement in a
|
2000-11-30 01:22:44 -04:00
|
|
|
loop.
|
2000-09-26 13:31:30 -03:00
|
|
|
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
Standard library and extensions
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- array: reverse() method of array now works. buffer_info() now does
|
2000-09-26 02:32:36 -03:00
|
|
|
argument checking; it still takes no arguments.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- asyncore/asynchat: Included most recent version from Sam Rushing.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- cgi: Accept '&' or ';' as separator characters when parsing form data.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- CGIHTTPServer: Now works on Windows (and perhaps even Mac).
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- ConfigParser: When reading the file, options spelled in upper case
|
2000-09-26 08:16:10 -03:00
|
|
|
letters are now correctly converted to lowercase.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- copy: Copy Unicode objects atomically.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- cPickle: Fail gracefully when copy_reg can't be imported.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- cStringIO: Implemented readlines() method.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:40:27 -03:00
|
|
|
- dbm: Add get() and setdefault() methods to dbm object. Add constant
|
|
|
|
`library' to module that names the library used. Added doc strings
|
|
|
|
and method names to error messages. Uses configure to determine
|
|
|
|
which ndbm.h file to include; Berkeley DB's nbdm and GDBM's ndbm is
|
|
|
|
now available options.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- distutils: Update to version 0.9.3.
|
|
|
|
|
|
|
|
- dl: Add several dl.RTLD_ constants.
|
|
|
|
|
|
|
|
- fpectl: Now supported on FreeBSD.
|
|
|
|
|
|
|
|
- gc: Add DEBUG_SAVEALL option. When enabled all garbage objects
|
|
|
|
found by the collector will be saved in gc.garbage. This is useful
|
|
|
|
for debugging a program that creates reference cycles.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- httplib: Three changes: Restore support for set_debuglevel feature
|
2000-09-26 02:32:36 -03:00
|
|
|
of HTTP class. Do not close socket on zero-length response. Do not
|
|
|
|
crash when server sends invalid content-length header.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- mailbox: Mailbox class conforms better to qmail specifications.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- marshal: When reading a short, sign-extend on platforms where shorts
|
|
|
|
are bigger than 16 bits. When reading a long, repair the unportable
|
|
|
|
sign extension that was being done for 64-bit machines. (It assumed
|
|
|
|
that signed right shift sign-extends.)
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- operator: Add contains(), invert(), __invert__() as aliases for
|
|
|
|
__contains__(), inv(), and __inv__() respectively.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- os: Add support for popen2() and popen3() on all platforms where
|
|
|
|
fork() exists. (popen4() is still in the works.)
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- os: (Windows only:) Add startfile() function that acts like double-
|
2000-09-26 03:33:09 -03:00
|
|
|
clicking on a file in Explorer (or passing the file name to the
|
|
|
|
DOS "start" command).
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- os.path: (Windows, DOS:) Treat trailing colon correctly in
|
2000-09-26 03:33:09 -03:00
|
|
|
os.path.join. os.path.join("a:", "b") yields "a:b".
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- pickle: Now raises ValueError when an invalid pickle that contains
|
|
|
|
a non-string repr where a string repr was expected. This behavior
|
|
|
|
matches cPickle.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- posixfile: Remove broken __del__() method.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- py_compile: support CR+LF line terminators in source file.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- readline: Does not immediately exit when ^C is hit when readline and
|
2000-09-26 13:31:30 -03:00
|
|
|
threads are configured. Adds definition of rl_library_version. (The
|
2000-09-26 08:16:10 -03:00
|
|
|
latter addition requires GNU readline 2.2 or later.)
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- rfc822: Domain literals returned by AddrlistClass method
|
2000-09-26 08:16:10 -03:00
|
|
|
getdomainliteral() are now properly wrapped in brackets.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- site: sys.setdefaultencoding() should only be called in case the
|
2000-09-26 03:33:09 -03:00
|
|
|
standard default encoding ("ascii") is changed. This saves quite a
|
2000-09-26 02:32:36 -03:00
|
|
|
few cycles during startup since the first call to
|
|
|
|
setdefaultencoding() will initialize the codec registry and the
|
|
|
|
encodings package.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- socket: Support for size hint in readlines() method of object returned
|
|
|
|
by makefile().
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- sre: Added experimental expand() method to match objects. Does not
|
2000-10-02 10:43:33 -03:00
|
|
|
use buffer interface on Unicode strings. Does not hang if group id
|
2000-09-26 02:32:36 -03:00
|
|
|
is followed by whitespace.
|
|
|
|
|
2000-11-30 01:22:44 -04:00
|
|
|
- StringIO: Size hint in readlines() is now supported as documented.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- struct: Check ranges for bytes and shorts.
|
|
|
|
|
|
|
|
- urllib: Improved handling of win32 proxy settings. Fixed quote and
|
2000-09-26 08:16:10 -03:00
|
|
|
quote_plus functions so that the always encode a comma.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- Tkinter: Image objects are now guaranteed to have unique ids. Set
|
|
|
|
event.delta to zero if Tk version doesn't support mousewheel.
|
|
|
|
Removed some debugging prints.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- UserList: now implements __contains__().
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:40:27 -03:00
|
|
|
- webbrowser: On Windows, use os.startfile() instead of os.popen(),
|
2000-09-26 08:16:10 -03:00
|
|
|
which works around a bug in Norton AntiVirus 2000 that leads directly
|
|
|
|
to a Blue Screen freeze.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- xml: New version detection code allows PyXML to override standard
|
|
|
|
XML package if PyXML version is greater than 0.6.1.
|
|
|
|
|
2000-09-26 13:21:35 -03:00
|
|
|
- xml.dom: DOM level 1 support for basic XML. Includes xml.dom.minidom
|
|
|
|
(conventional DOM), and xml.dom.pulldom, which allows building the DOM
|
|
|
|
tree only for nodes which are sufficiently interesting to a specific
|
|
|
|
application. Does not provide the HTML-specific extensions. Still
|
|
|
|
undocumented.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:21:35 -03:00
|
|
|
- xml.sax: SAX 2 support for Python, including all the handler
|
|
|
|
interfaces needed to process XML 1.0 compliant XML. Some
|
|
|
|
documentation is already available.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:21:35 -03:00
|
|
|
- pyexpat: Renamed to xml.parsers.expat since this is part of the new,
|
|
|
|
packagized XML support.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
|
2000-09-26 02:32:36 -03:00
|
|
|
C API
|
|
|
|
|
|
|
|
- Add three new convenience functions for module initialization --
|
|
|
|
PyModule_AddObject(), PyModule_AddIntConstant(), and
|
|
|
|
PyModule_AddStringConstant().
|
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- Cleaned up definition of NULL in C source code; all definitions were
|
2000-09-26 02:32:36 -03:00
|
|
|
removed and add #error to Python.h if NULL isn't defined after
|
|
|
|
#include of stdio.h.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- Py_PROTO() macros that were removed in 2.0b1 have been restored for
|
2000-09-26 02:32:36 -03:00
|
|
|
backwards compatibility (at the source level) with old extensions.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- A wrapper API was added for signal() and sigaction(). Instead of
|
|
|
|
either function, always use PyOS_getsig() to get a signal handler
|
|
|
|
and PyOS_setsig() to set one. A new convenience typedef
|
|
|
|
PyOS_sighandler_t is defined for the type of signal handlers.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- Add PyString_AsStringAndSize() function that provides access to the
|
2000-09-26 02:32:36 -03:00
|
|
|
internal data buffer and size of a string object -- or the default
|
|
|
|
encoded version of a Unicode object.
|
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- PyString_Size() and PyString_AsString() accept Unicode objects.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
- The standard header <limits.h> is now included by Python.h (if it
|
2000-09-26 13:21:35 -03:00
|
|
|
exists). INT_MAX and LONG_MAX will always be defined, even if
|
|
|
|
<limits.h> is not available.
|
2000-09-26 08:16:10 -03:00
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- PyFloat_FromString takes a second argument, pend, that was
|
|
|
|
effectively useless. It is now officially useless but preserved for
|
|
|
|
backwards compatibility. If the pend argument is not NULL, *pend is
|
|
|
|
set to NULL.
|
|
|
|
|
|
|
|
- PyObject_GetAttr() and PyObject_SetAttr() now accept Unicode objects
|
|
|
|
for the attribute name. See note on getattr() above.
|
|
|
|
|
|
|
|
- A few bug fixes to argument processing for Unicode.
|
|
|
|
PyArg_ParseTupleAndKeywords() now accepts "es#" and "es".
|
|
|
|
PyArg_Parse() special cases "s#" for Unicode objects; it returns a
|
|
|
|
pointer to the default encoded string data instead of to the raw
|
2000-11-30 01:22:44 -04:00
|
|
|
UTF-16.
|
2000-09-26 13:31:30 -03:00
|
|
|
|
|
|
|
- Py_BuildValue accepts B format (for bgen-generated code).
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
|
2000-09-26 02:32:36 -03:00
|
|
|
Internals
|
|
|
|
|
|
|
|
- On Unix, fix code for finding Python installation directory so that
|
|
|
|
it works when argv[0] is a relative path.
|
|
|
|
|
2000-12-14 21:16:43 -04:00
|
|
|
- Added a true unicode_internal_encode() function and fixed the
|
2000-09-26 08:16:10 -03:00
|
|
|
unicode_internal_decode function() to support Unicode objects directly
|
2000-09-26 02:32:36 -03:00
|
|
|
rather than by generating a copy of the object.
|
|
|
|
|
2000-09-26 03:33:09 -03:00
|
|
|
- Several of the internal Unicode tables are much smaller now, and
|
|
|
|
the source code should be much friendlier to weaker compilers.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 14:42:51 -03:00
|
|
|
- In the garbage collector: Fixed bug in collection of tuples. Fixed
|
|
|
|
bug that caused some instances to be removed from the container set
|
|
|
|
while they were still live. Fixed parsing in gc.set_debug() for
|
|
|
|
platforms where sizeof(long) > sizeof(int).
|
2000-09-26 13:31:30 -03:00
|
|
|
|
|
|
|
- Fixed refcount problem in instance deallocation that only occurred
|
|
|
|
when Py_REF_DEBUG was defined and Py_TRACE_REFS was not.
|
|
|
|
|
|
|
|
- On Windows, getpythonregpath is now protected against null data in
|
|
|
|
registry key.
|
|
|
|
|
|
|
|
- On Unix, create .pyc/.pyo files with O_EXCL flag to avoid a race
|
2000-11-30 01:22:44 -04:00
|
|
|
condition.
|
2000-09-26 13:31:30 -03:00
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
|
2000-09-26 02:32:36 -03:00
|
|
|
Build and platform-specific issues
|
|
|
|
|
|
|
|
- Better support of GNU Pth via --with-pth configure option.
|
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- Python/C API now properly exposed to dynamically-loaded extension
|
|
|
|
modules on Reliant UNIX.
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
- Changes for the benefit of SunOS 4.1.4 (really!). mmapmodule.c:
|
|
|
|
Don't define MS_SYNC to be zero when it is undefined. Added missing
|
|
|
|
prototypes in posixmodule.c.
|
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- Improved support for HP-UX build. Threads should now be correctly
|
2000-09-26 08:16:10 -03:00
|
|
|
configured (on HP-UX 10.20 and 11.00).
|
2000-09-26 02:32:36 -03:00
|
|
|
|
2000-09-26 13:31:30 -03:00
|
|
|
- Fix largefile support on older NetBSD systems and OpenBSD by adding
|
|
|
|
define for TELL64.
|
|
|
|
|
|
|
|
|
|
|
|
Tools and other miscellany
|
|
|
|
|
|
|
|
- ftpmirror: Call to main() is wrapped in if __name__ == "__main__".
|
|
|
|
|
|
|
|
- freeze: The modulefinder now works with 2.0 opcodes.
|
|
|
|
|
2000-11-30 01:22:44 -04:00
|
|
|
- IDLE:
|
2000-09-26 13:31:30 -03:00
|
|
|
Move hackery of sys.argv until after the Tk instance has been
|
|
|
|
created, which allows the application-specific Tkinter
|
|
|
|
initialization to be executed if present; also pass an explicit
|
|
|
|
className parameter to the Tk() constructor.
|
2000-09-26 13:21:35 -03:00
|
|
|
|
2000-09-26 02:32:36 -03:00
|
|
|
|
|
|
|
What's new in 2.0 beta 1?
|
|
|
|
=========================
|
1998-10-17 16:43:13 -03:00
|
|
|
|
2000-09-05 01:38:34 -03:00
|
|
|
Source Incompatibilities
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
None. Note that 1.6 introduced several incompatibilities with 1.5.2,
|
|
|
|
such as single-argument append(), connect() and bind(), and changes to
|
|
|
|
str(long) and repr(float).
|
|
|
|
|
|
|
|
|
|
|
|
Binary Incompatibilities
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
- Third party extensions built for Python 1.5.x or 1.6 cannot be used
|
|
|
|
with Python 2.0; these extensions will have to be rebuilt for Python
|
|
|
|
2.0.
|
|
|
|
|
|
|
|
- On Windows, attempting to import a third party extension built for
|
|
|
|
Python 1.5.x or 1.6 results in an immediate crash; there's not much we
|
|
|
|
can do about this. Check your PYTHONPATH environment variable!
|
|
|
|
|
|
|
|
- Python bytecode files (*.pyc and *.pyo) are not compatible between
|
|
|
|
releases.
|
|
|
|
|
|
|
|
|
|
|
|
Overview of Changes Since 1.6
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
There are many new modules (including brand new XML support through
|
|
|
|
the xml package, and i18n support through the gettext module); a list
|
|
|
|
of all new modules is included below. Lots of bugs have been fixed.
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
The process for making major new changes to the language has changed
|
|
|
|
since Python 1.6. Enhancements must now be documented by a Python
|
|
|
|
Enhancement Proposal (PEP) before they can be accepted.
|
|
|
|
|
2000-09-05 01:38:34 -03:00
|
|
|
There are several important syntax enhancements, described in more
|
|
|
|
detail below:
|
|
|
|
|
|
|
|
- Augmented assignment, e.g. x += 1
|
|
|
|
|
|
|
|
- List comprehensions, e.g. [x**2 for x in range(10)]
|
|
|
|
|
|
|
|
- Extended import statement, e.g. import Module as Name
|
|
|
|
|
|
|
|
- Extended print statement, e.g. print >> file, "Hello"
|
|
|
|
|
|
|
|
Other important changes:
|
|
|
|
|
|
|
|
- Optional collection of cyclical garbage
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
Python Enhancement Proposal (PEP)
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
PEP stands for Python Enhancement Proposal. A PEP is a design
|
|
|
|
document providing information to the Python community, or describing
|
|
|
|
a new feature for Python. The PEP should provide a concise technical
|
|
|
|
specification of the feature and a rationale for the feature.
|
|
|
|
|
|
|
|
We intend PEPs to be the primary mechanisms for proposing new
|
|
|
|
features, for collecting community input on an issue, and for
|
|
|
|
documenting the design decisions that have gone into Python. The PEP
|
|
|
|
author is responsible for building consensus within the community and
|
|
|
|
documenting dissenting opinions.
|
|
|
|
|
|
|
|
The PEPs are available at http://python.sourceforge.net/peps/.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
Augmented Assignment
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
This must have been the most-requested feature of the past years!
|
|
|
|
Eleven new assignment operators were added:
|
|
|
|
|
2000-09-05 09:42:46 -03:00
|
|
|
+= -= *= /= %= **= <<= >>= &= ^= |=
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
For example,
|
|
|
|
|
|
|
|
A += B
|
|
|
|
|
|
|
|
is similar to
|
|
|
|
|
|
|
|
A = A + B
|
|
|
|
|
|
|
|
except that A is evaluated only once (relevant when A is something
|
|
|
|
like dict[index].attr).
|
|
|
|
|
|
|
|
However, if A is a mutable object, A may be modified in place. Thus,
|
|
|
|
if A is a number or a string, A += B has the same effect as A = A+B
|
|
|
|
(except A is only evaluated once); but if a is a list, A += B has the
|
|
|
|
same effect as A.extend(B)!
|
|
|
|
|
|
|
|
Classes and built-in object types can override the new operators in
|
|
|
|
order to implement the in-place behavior; the not-in-place behavior is
|
|
|
|
used automatically as a fallback when an object doesn't implement the
|
|
|
|
in-place behavior. For classes, the method name is derived from the
|
|
|
|
method name for the corresponding not-in-place operator by inserting
|
|
|
|
an 'i' in front of the name, e.g. __iadd__ implements in-place
|
|
|
|
__add__.
|
|
|
|
|
|
|
|
Augmented assignment was implemented by Thomas Wouters.
|
|
|
|
|
|
|
|
|
|
|
|
List Comprehensions
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
This is a flexible new notation for lists whose elements are computed
|
|
|
|
from another list (or lists). The simplest form is:
|
|
|
|
|
|
|
|
[<expression> for <variable> in <sequence>]
|
|
|
|
|
2000-09-06 20:34:25 -03:00
|
|
|
For example, [i**2 for i in range(4)] yields the list [0, 1, 4, 9].
|
2000-09-26 08:16:10 -03:00
|
|
|
This is more efficient than a for loop with a list.append() call.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
You can also add a condition:
|
|
|
|
|
|
|
|
[<expression> for <variable> in <sequence> if <condition>]
|
|
|
|
|
|
|
|
For example, [w for w in words if w == w.lower()] would yield the list
|
|
|
|
of words that contain no uppercase characters. This is more efficient
|
2000-09-26 08:16:10 -03:00
|
|
|
than a for loop with an if statement and a list.append() call.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
You can also have nested for loops and more than one 'if' clause. For
|
|
|
|
example, here's a function that flattens a sequence of sequences::
|
|
|
|
|
|
|
|
def flatten(seq):
|
|
|
|
return [x for subseq in seq for x in subseq]
|
|
|
|
|
|
|
|
flatten([[0], [1,2,3], [4,5], [6,7,8,9], []])
|
|
|
|
|
|
|
|
This prints
|
|
|
|
|
|
|
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
|
|
|
|
|
|
List comprehensions originated as a patch set from Greg Ewing; Skip
|
2000-09-05 16:36:26 -03:00
|
|
|
Montanaro and Thomas Wouters also contributed. Described by PEP 202.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
|
|
|
|
Extended Import Statement
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
Many people have asked for a way to import a module under a different
|
|
|
|
name. This can be accomplished like this:
|
|
|
|
|
|
|
|
import foo
|
|
|
|
bar = foo
|
|
|
|
del foo
|
|
|
|
|
|
|
|
but this common idiom gets old quickly. A simple extension of the
|
|
|
|
import statement now allows this to be written as follows:
|
|
|
|
|
|
|
|
import foo as bar
|
|
|
|
|
|
|
|
There's also a variant for 'from ... import':
|
|
|
|
|
|
|
|
from foo import bar as spam
|
|
|
|
|
|
|
|
This also works with packages; e.g. you can write this:
|
|
|
|
|
|
|
|
import test.regrtest as regrtest
|
|
|
|
|
|
|
|
Note that 'as' is not a new keyword -- it is recognized only in this
|
|
|
|
context (this is only possible because the syntax for the import
|
|
|
|
statement doesn't involve expressions).
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
Implemented by Thomas Wouters. Described by PEP 221.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
|
|
|
|
Extended Print Statement
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
Easily the most controversial new feature, this extension to the print
|
|
|
|
statement adds an option to make the output go to a different file
|
|
|
|
than the default sys.stdout.
|
|
|
|
|
|
|
|
For example, to write an error message to sys.stderr, you can now
|
|
|
|
write:
|
|
|
|
|
|
|
|
print >> sys.stderr, "Error: bad dog!"
|
|
|
|
|
|
|
|
As a special feature, if the expression used to indicate the file
|
2000-09-29 14:09:11 -03:00
|
|
|
evaluates to None, the current value of sys.stdout is used. Thus:
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
print >> None, "Hello world"
|
|
|
|
|
|
|
|
is equivalent to
|
|
|
|
|
|
|
|
print "Hello world"
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
Design and implementation by Barry Warsaw. Described by PEP 214.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
|
|
|
|
Optional Collection of Cyclical Garbage
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
Python is now equipped with a garbage collector that can hunt down
|
|
|
|
cyclical references between Python objects. It's no replacement for
|
|
|
|
reference counting; in fact, it depends on the reference counts being
|
|
|
|
correct, and decides that a set of objects belong to a cycle if all
|
|
|
|
their reference counts can be accounted for from their references to
|
|
|
|
each other. This devious scheme was first proposed by Eric Tiedemann,
|
|
|
|
and brought to implementation by Neil Schemenauer.
|
|
|
|
|
|
|
|
There's a module "gc" that lets you control some parameters of the
|
|
|
|
garbage collection. There's also an option to the configure script
|
|
|
|
that lets you enable or disable the garbage collection. In 2.0b1,
|
|
|
|
it's on by default, so that we (hopefully) can collect decent user
|
|
|
|
experience with this new feature. There are some questions about its
|
2000-09-29 14:54:40 -03:00
|
|
|
performance. If it proves to be too much of a problem, we'll turn it
|
2000-09-05 01:38:34 -03:00
|
|
|
off by default in the final 2.0 release.
|
|
|
|
|
|
|
|
|
|
|
|
Smaller Changes
|
|
|
|
---------------
|
|
|
|
|
|
|
|
A new function zip() was added. zip(seq1, seq2, ...) is equivalent to
|
|
|
|
map(None, seq1, seq2, ...) when the sequences have the same length;
|
|
|
|
i.e. zip([1,2,3], [10,20,30]) returns [(1,10), (2,20), (3,30)]. When
|
|
|
|
the lists are not all the same length, the shortest list wins:
|
2000-09-05 16:36:26 -03:00
|
|
|
zip([1,2,3], [10,20]) returns [(1,10), (2,20)]. See PEP 201.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
sys.version_info is a tuple (major, minor, micro, level, serial).
|
|
|
|
|
|
|
|
Dictionaries have an odd new method, setdefault(key, default).
|
|
|
|
dict.setdefault(key, default) returns dict[key] if it exists; if not,
|
|
|
|
it sets dict[key] to default and returns that value. Thus:
|
|
|
|
|
|
|
|
dict.setdefault(key, []).append(item)
|
|
|
|
|
|
|
|
does the same work as this common idiom:
|
|
|
|
|
|
|
|
if not dict.has_key(key):
|
|
|
|
dict[key] = []
|
|
|
|
dict[key].append(item)
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
There are two new variants of SyntaxError that are raised for
|
|
|
|
indentation-related errors: IndentationError and TabError.
|
|
|
|
|
|
|
|
Changed \x to consume exactly two hex digits; see PEP 223. Added \U
|
|
|
|
escape that consumes exactly eight hex digits.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
The limits on the size of expressions and file in Python source code
|
|
|
|
have been raised from 2**16 to 2**32. Previous versions of Python
|
|
|
|
were limited because the maximum argument size the Python VM accepted
|
|
|
|
was 2**16. This limited the size of object constructor expressions,
|
|
|
|
e.g. [1,2,3] or {'a':1, 'b':2}, and the size of source files. This
|
|
|
|
limit was raised thanks to a patch by Charles Waldman that effectively
|
|
|
|
fixes the problem. It is now much more likely that you will be
|
|
|
|
limited by available memory than by an arbitrary limit in Python.
|
|
|
|
|
|
|
|
The interpreter's maximum recursion depth can be modified by Python
|
|
|
|
programs using sys.getrecursionlimit and sys.setrecursionlimit. This
|
|
|
|
limit is the maximum number of recursive calls that can be made by
|
|
|
|
Python code. The limit exists to prevent infinite recursion from
|
|
|
|
overflowing the C stack and causing a core dump. The default value is
|
|
|
|
1000. The maximum safe value for a particular platform can be found
|
|
|
|
by running Misc/find_recursionlimit.py.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
|
|
|
New Modules and Packages
|
|
|
|
------------------------
|
|
|
|
|
|
|
|
atexit - for registering functions to be called when Python exits.
|
|
|
|
|
|
|
|
imputil - Greg Stein's alternative API for writing custom import
|
|
|
|
hooks.
|
|
|
|
|
|
|
|
pyexpat - an interface to the Expat XML parser, contributed by Paul
|
|
|
|
Prescod.
|
|
|
|
|
|
|
|
xml - a new package with XML support code organized (so far) in three
|
|
|
|
subpackages: xml.dom, xml.sax, and xml.parsers. Describing these
|
|
|
|
would fill a volume. There's a special feature whereby a
|
|
|
|
user-installed package named _xmlplus overrides the standard
|
|
|
|
xmlpackage; this is intended to give the XML SIG a hook to distribute
|
|
|
|
backwards-compatible updates to the standard xml package.
|
|
|
|
|
|
|
|
webbrowser - a platform-independent API to launch a web browser.
|
|
|
|
|
|
|
|
|
2000-09-05 09:42:46 -03:00
|
|
|
Changed Modules
|
|
|
|
---------------
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
array -- new methods for array objects: count, extend, index, pop, and
|
|
|
|
remove
|
|
|
|
|
|
|
|
binascii -- new functions b2a_hex and a2b_hex that convert between
|
|
|
|
binary data and its hex representation
|
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
calendar -- Many new functions that support features including control
|
|
|
|
over which day of the week is the first day, returning strings instead
|
|
|
|
of printing them. Also new symbolic constants for days of week,
|
|
|
|
e.g. MONDAY, ..., SUNDAY.
|
|
|
|
|
|
|
|
cgi -- FieldStorage objects have a getvalue method that works like a
|
|
|
|
dictionary's get method and returns the value attribute of the object.
|
|
|
|
|
|
|
|
ConfigParser -- The parser object has new methods has_option,
|
|
|
|
remove_section, remove_option, set, and write. They allow the module
|
|
|
|
to be used for writing config files as well as reading them.
|
|
|
|
|
|
|
|
ftplib -- ntransfercmd(), transfercmd(), and retrbinary() all now
|
2000-09-05 09:42:46 -03:00
|
|
|
optionally support the RFC 959 REST command.
|
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
gzip -- readline and readlines now accept optional size arguments
|
|
|
|
|
|
|
|
httplib -- New interfaces and support for HTTP/1.1 by Greg Stein. See
|
|
|
|
the module doc strings for details.
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
locale -- implement getdefaultlocale for Win32 and Macintosh
|
|
|
|
|
|
|
|
marshal -- no longer dumps core when marshaling deeply nested or
|
|
|
|
recursive data structures
|
|
|
|
|
|
|
|
os -- new functions isatty, seteuid, setegid, setreuid, setregid
|
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
os/popen2 -- popen2/popen3/popen4 support under Windows. popen2/popen3
|
|
|
|
support under Unix.
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
os/pty -- support for openpty and forkpty
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
os.path -- fix semantics of os.path.commonprefix
|
|
|
|
|
|
|
|
smtplib -- support for sending very long messages
|
|
|
|
|
|
|
|
socket -- new function getfqdn()
|
2000-09-05 09:42:46 -03:00
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
readline -- new functions to read, write and truncate history files.
|
|
|
|
The readline section of the library reference manual contains an
|
|
|
|
example.
|
2000-09-05 12:34:16 -03:00
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
select -- add interface to poll system call
|
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
shutil -- new copyfileobj function
|
|
|
|
|
|
|
|
SimpleHTTPServer, CGIHTTPServer -- Fix problems with buffering in the
|
|
|
|
HTTP server.
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
Tkinter -- optimization of function flatten
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
urllib -- scans environment variables for proxy configuration,
|
2000-09-05 17:15:25 -03:00
|
|
|
e.g. http_proxy.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
whichdb -- recognizes dumbdbm format
|
2000-09-05 09:42:46 -03:00
|
|
|
|
|
|
|
|
|
|
|
Obsolete Modules
|
|
|
|
----------------
|
|
|
|
|
|
|
|
None. However note that 1.6 made a whole slew of modules obsolete:
|
|
|
|
stdwin, soundex, cml, cmpcache, dircache, dump, find, grep, packmail,
|
|
|
|
poly, zmod, strop, util, whatsound.
|
|
|
|
|
|
|
|
|
|
|
|
Changed, New, Obsolete Tools
|
|
|
|
----------------------------
|
|
|
|
|
2000-09-05 17:15:25 -03:00
|
|
|
None.
|
2000-09-05 09:42:46 -03:00
|
|
|
|
|
|
|
|
2000-09-05 01:38:34 -03:00
|
|
|
C-level Changes
|
|
|
|
---------------
|
|
|
|
|
|
|
|
Several cleanup jobs were carried out throughout the source code.
|
|
|
|
|
|
|
|
All C code was converted to ANSI C; we got rid of all uses of the
|
|
|
|
Py_PROTO() macro, which makes the header files a lot more readable.
|
|
|
|
|
|
|
|
Most of the portability hacks were moved to a new header file,
|
|
|
|
pyport.h; several other new header files were added and some old
|
|
|
|
header files were removed, in an attempt to create a more rational set
|
|
|
|
of header files. (Few of these ever need to be included explicitly;
|
|
|
|
they are all included by Python.h.)
|
|
|
|
|
|
|
|
Trent Mick ensured portability to 64-bit platforms, under both Linux
|
2000-09-05 16:36:26 -03:00
|
|
|
and Win64, especially for the new Intel Itanium processor. Mick also
|
|
|
|
added large file support for Linux64 and Win64.
|
2000-09-05 01:38:34 -03:00
|
|
|
|
2000-09-05 15:28:54 -03:00
|
|
|
The C APIs to return an object's size have been update to consistently
|
|
|
|
use the form PyXXX_Size, e.g. PySequence_Size and PyDict_Size. In
|
|
|
|
previous versions, the abstract interfaces used PyXXX_Length and the
|
|
|
|
concrete interfaces used PyXXX_Size. The old names,
|
|
|
|
e.g. PyObject_Length, are still available for backwards compatibility
|
|
|
|
at the API level, but are deprecated.
|
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
The PyOS_CheckStack function has been implemented on Windows by
|
|
|
|
Fredrik Lundh. It prevents Python from failing with a stack overflow
|
|
|
|
on Windows.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
The GC changes resulted in creation of two new slots on object,
|
|
|
|
tp_traverse and tp_clear. The augmented assignment changes result in
|
2000-09-06 10:02:08 -03:00
|
|
|
the creation of a new slot for each in-place operator.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
|
|
|
The GC API creates new requirements for container types implemented in
|
2000-09-06 10:02:08 -03:00
|
|
|
C extension modules. See Include/objimpl.h for details.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
PyErr_Format has been updated to automatically calculate the size of
|
|
|
|
the buffer needed to hold the formatted result string. This change
|
|
|
|
prevents crashes caused by programmer error.
|
|
|
|
|
|
|
|
New C API calls: PyObject_AsFileDescriptor, PyErr_WriteUnraisable.
|
2000-09-05 15:28:54 -03:00
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
PyRun_AnyFileEx, PyRun_SimpleFileEx, PyRun_FileEx -- New functions
|
|
|
|
that are the same as their non-Ex counterparts except they take an
|
|
|
|
extra flag argument that tells them to close the file when done.
|
2000-09-05 09:42:46 -03:00
|
|
|
|
2000-09-05 16:36:26 -03:00
|
|
|
XXX There were other API changes that should be fleshed out here.
|
1998-08-10 19:01:13 -03:00
|
|
|
|
2000-09-05 17:15:25 -03:00
|
|
|
|
|
|
|
Windows Changes
|
|
|
|
---------------
|
|
|
|
|
|
|
|
New popen2/popen3/peopen4 in os module (see Changed Modules above).
|
|
|
|
|
|
|
|
os.popen is much more usable on Windows 95 and 98. See Microsoft
|
|
|
|
Knowledge Base article Q150956. The Win9x workaround described there
|
|
|
|
is implemented by the new w9xpopen.exe helper in the root of your
|
|
|
|
Python installation. Note that Python uses this internally; it is not
|
|
|
|
a standalone program.
|
|
|
|
|
|
|
|
Administrator privileges are no longer required to install Python
|
|
|
|
on Windows NT or Windows 2000. If you have administrator privileges,
|
|
|
|
Python's registry info will be written under HKEY_LOCAL_MACHINE.
|
|
|
|
Otherwise the installer backs off to writing Python's registry info
|
2000-09-06 10:02:08 -03:00
|
|
|
under HKEY_CURRENT_USER. The latter is sufficient for all "normal"
|
2000-09-05 17:15:25 -03:00
|
|
|
uses of Python, but will prevent some advanced uses from working
|
|
|
|
(for example, running a Python script as an NT service, or possibly
|
|
|
|
from CGI).
|
|
|
|
|
|
|
|
[This was new in 1.6] The installer no longer runs a separate Tcl/Tk
|
|
|
|
installer; instead, it installs the needed Tcl/Tk files directly in the
|
|
|
|
Python directory. If you already have a Tcl/Tk installation, this
|
|
|
|
wastes some disk space (about 4 Megs) but avoids problems with
|
|
|
|
conflicting Tcl/Tk installations, and makes it much easier for Python
|
|
|
|
to ensure that Tcl/Tk can find all its files.
|
|
|
|
|
|
|
|
[This was new in 1.6] The Windows installer now installs by default in
|
|
|
|
\Python20\ on the default volume, instead of \Program Files\Python-2.0\.
|
|
|
|
|
2000-09-26 08:16:10 -03:00
|
|
|
|
|
|
|
Updates to the changes between 1.5.2 and 1.6
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
The 1.6 NEWS file can't be changed after the release is done, so here
|
|
|
|
is some late-breaking news:
|
|
|
|
|
|
|
|
New APIs in locale.py: normalize(), getdefaultlocale(), resetlocale(),
|
|
|
|
and changes to getlocale() and setlocale().
|
|
|
|
|
|
|
|
The new module is now enabled per default.
|
|
|
|
|
|
|
|
It is not true that the encodings codecs cannot be used for normal
|
|
|
|
strings: the string.encode() (which is also present on 8-bit strings
|
|
|
|
!) allows using them for 8-bit strings too, e.g. to convert files from
|
|
|
|
cp1252 (Windows) to latin-1 or vice-versa.
|
|
|
|
|
|
|
|
Japanese codecs are available from Tamito KAJIYAMA:
|
|
|
|
http://pseudo.grad.sccs.chukyo-u.ac.jp/~kajiyama/python/
|
|
|
|
|
|
|
|
|
1997-12-11 16:35:47 -04:00
|
|
|
======================================================================
|