2001-12-21 17:36:50 -04:00
|
|
|
|
What's New in Python 2.3 alpha 1?
|
|
|
|
|
XXX Release date: DD-MMM-2002 XXX
|
|
|
|
|
=================================
|
|
|
|
|
|
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
|
|
|
|
Core and builtins
|
|
|
|
|
|
2002-06-24 21:25:30 -03:00
|
|
|
|
- Slices and repetitions of buffer objects now consistently return
|
|
|
|
|
a string. Formerly, strings would be returned most of the time,
|
|
|
|
|
but a buffer object would be returned when the repetition count
|
|
|
|
|
was one or when the slice range was all inclusive.
|
|
|
|
|
|
2002-06-20 22:29:25 -03:00
|
|
|
|
- The __slots__ variable can now mention "private" names, and the
|
|
|
|
|
right thing will happen (e.g. __slots__ = ["__foo"]).
|
|
|
|
|
|
2002-06-17 07:43:59 -03:00
|
|
|
|
- Unicode objects in sys.path are no longer ignored but treated
|
|
|
|
|
as directory names.
|
|
|
|
|
|
2002-06-14 18:31:18 -03:00
|
|
|
|
- The built-ins slice() and buffer() are now callable types. The
|
|
|
|
|
types classobj (formerly class), code, function, instance, and
|
|
|
|
|
instancemethod (formerly instance-method), which have no built-in
|
|
|
|
|
names but are accessible through the types module, are now also
|
|
|
|
|
callable. The type dict-proxy is renamed to dictproxy.
|
|
|
|
|
|
2002-06-13 21:50:42 -03:00
|
|
|
|
- Fixed string.startswith and string.endswith builtin methods
|
|
|
|
|
so they accept negative indices. [SF bug 493951]
|
|
|
|
|
|
2002-06-12 00:45:21 -03:00
|
|
|
|
- Fixed a bug with a continue inside a try block and a yield in the
|
|
|
|
|
finally clause. [SF bug 567538]
|
|
|
|
|
|
2002-06-11 07:55:12 -03:00
|
|
|
|
- Most builtin sequences now support "extended slices", i.e. slices
|
2002-06-13 08:41:07 -03:00
|
|
|
|
with a third "stride" parameter. For example, "hello world"[::-1]
|
|
|
|
|
gives "dlrow olleh".
|
2002-06-11 07:55:12 -03:00
|
|
|
|
|
2002-06-10 18:39:42 -03:00
|
|
|
|
- Cycles going through the __class__ link of a new-style instance are
|
|
|
|
|
now detected by the garbage collector.
|
|
|
|
|
|
2002-06-04 16:52:53 -03:00
|
|
|
|
- Classes using __slots__ are now properly garbage collected.
|
|
|
|
|
[SF bug 519621]
|
|
|
|
|
|
|
|
|
|
- Tightened the __slots__ rules: a slot name must be a valid Python
|
|
|
|
|
identifier.
|
|
|
|
|
|
2002-06-04 02:58:34 -03:00
|
|
|
|
- The constructor for the module type now requires a name argument and
|
|
|
|
|
takes an optional docstring argument. Previously, this constructor
|
|
|
|
|
ignored its arguments. As a consequence, deriving a class from a
|
|
|
|
|
module (not from the module type) is now illegal; previously this
|
|
|
|
|
created an unnamed module, just like invoking the module type did.
|
|
|
|
|
[SF bug 563060]
|
|
|
|
|
|
2002-05-29 12:54:55 -03:00
|
|
|
|
- A new warning PendingDeprecationWarning was added to provide
|
|
|
|
|
direction on features which are in the process of being deprecated.
|
|
|
|
|
The warning will not be printed by default. To see the pending
|
|
|
|
|
deprecations, use -Walways::PendingDeprecationWarning::
|
|
|
|
|
as a command line option or warnings.filterwarnings() in code.
|
|
|
|
|
|
2002-05-31 16:58:02 -03:00
|
|
|
|
- A new type object, 'basestring', is added. This is a common base type
|
2002-05-24 16:01:59 -03:00
|
|
|
|
for 'str' and 'unicode', and can be used instead of
|
|
|
|
|
types.StringTypes, e.g. to test whether something is "a string":
|
2002-05-31 16:58:02 -03:00
|
|
|
|
isinstance(x, basestring) is True for Unicode and 8-bit strings. This
|
2002-05-24 16:01:59 -03:00
|
|
|
|
is an abstract base class and cannot be instantiated directly.
|
|
|
|
|
|
2002-05-02 18:28:26 -03:00
|
|
|
|
- Deprecated features of xrange objects have been removed as
|
|
|
|
|
promised. The start, stop, and step attributes and the tolist()
|
|
|
|
|
method no longer exist. xrange repetition and slicing have been
|
|
|
|
|
removed.
|
|
|
|
|
|
2002-04-26 16:40:56 -03:00
|
|
|
|
- New builtin function enumerate(x), from PEP 279. Example:
|
|
|
|
|
enumerate("abc") is an iterator returning (0,"a"), (1,"b"), (2,"c").
|
|
|
|
|
The argument can be an arbitrary iterable object.
|
|
|
|
|
|
2002-04-25 22:58:53 -03:00
|
|
|
|
- The assert statement no longer tests __debug__ at runtime. This means
|
|
|
|
|
that assert statements cannot be disabled by assigning a false value
|
|
|
|
|
to __debug__.
|
|
|
|
|
|
2002-04-15 10:36:47 -03:00
|
|
|
|
- A method zfill() was added to str and unicode, that fills a numeric
|
|
|
|
|
string to the left with zeros. For example,
|
|
|
|
|
"+123".zfill(6) -> "+00123".
|
|
|
|
|
|
2002-04-15 09:36:47 -03:00
|
|
|
|
- Complex numbers supported divmod() and the // and % operators, but
|
|
|
|
|
these make no sense. Since this was documented, they're being
|
|
|
|
|
deprecated now.
|
|
|
|
|
|
2002-04-26 17:11:29 -03:00
|
|
|
|
- String and unicode methods lstrip(), rstrip() and strip() now take
|
|
|
|
|
an optional argument that specifies the characters to strip. For
|
|
|
|
|
example, "Foo!!!?!?!?".rstrip("?!") -> "Foo".
|
2002-04-12 21:59:05 -03:00
|
|
|
|
|
2002-04-12 16:22:48 -03:00
|
|
|
|
- Added a new dict method pop(key). This removes and returns the
|
|
|
|
|
value corresponding to key. [SF patch #539949]
|
|
|
|
|
|
2002-04-05 21:05:01 -04:00
|
|
|
|
- Changed new-style class instantiation so that when C's __new__
|
|
|
|
|
method returns something that's not a C instance, its __init__ is
|
|
|
|
|
not called. [SF bug #537450]
|
|
|
|
|
|
2002-04-05 20:23:25 -04:00
|
|
|
|
- Fixed super() to work correctly with class methods. [SF bug #535444]
|
|
|
|
|
|
2002-04-04 11:21:33 -04:00
|
|
|
|
- A new built-in type, bool, has been added, as well as built-in
|
|
|
|
|
names for its two values, True and False. Comparisons and sundry
|
|
|
|
|
other operations that return a truth value have been changed to
|
2002-05-07 17:58:03 -03:00
|
|
|
|
return a bool instead. Read PEP 285 for an explanation of why this
|
2002-04-04 11:21:33 -04:00
|
|
|
|
is backward compatible.
|
|
|
|
|
|
2002-03-28 21:07:24 -04:00
|
|
|
|
- Fixed two bugs reported as SF #535905: under certain conditions,
|
|
|
|
|
deallocating a deeply nested structure could cause a segfault in the
|
|
|
|
|
garbage collector, due to interaction with the "trashcan" code;
|
|
|
|
|
access to the current frame during destruction of a local variable
|
|
|
|
|
could access a pointer to freed memory.
|
|
|
|
|
|
2002-06-18 18:20:13 -03:00
|
|
|
|
- The optional object allocator ("pymalloc") has been enabled by
|
|
|
|
|
default. The recommended practice for memory allocation and
|
|
|
|
|
deallocation has been streamlined. A header file is included,
|
|
|
|
|
Misc/pymemcompat.h, which can be bundled with 3rd party extensions
|
|
|
|
|
and lets them use the same API with Python versions from 1.5.2
|
|
|
|
|
onwards.
|
2002-03-22 13:06:59 -04:00
|
|
|
|
|
2002-03-14 19:05:54 -04:00
|
|
|
|
- If you try to pickle an instance of a class that has __slots__ but
|
|
|
|
|
doesn't define or override __getstate__, a TypeError is now raised.
|
|
|
|
|
This is done by adding a bozo __getstate__ to the class that always
|
|
|
|
|
raises TypeError. (Before, this would appear to be pickled, but the
|
|
|
|
|
state of the slots would be lost.)
|
|
|
|
|
|
2002-03-03 17:30:27 -04:00
|
|
|
|
- PyErr_Display will provide file and line information for all exceptions
|
|
|
|
|
that have an attribute print_file_and_line, not just SyntaxErrors.
|
|
|
|
|
|
2002-02-09 07:28:43 -04:00
|
|
|
|
- The UTF-8 codec will now encode and decode Unicode surrogates
|
|
|
|
|
correctly and without raising exceptions for unpaired ones.
|
|
|
|
|
|
2002-01-01 15:07:13 -04:00
|
|
|
|
- file.xreadlines() now raises a ValueError if the file is closed:
|
|
|
|
|
Previously, an xreadlines object was returned which would raise
|
|
|
|
|
a ValueError when the xreadlines.next() method was called.
|
|
|
|
|
|
2002-05-07 17:58:03 -03:00
|
|
|
|
- sys.exit() inadvertently allowed more than one argument.
|
2002-03-27 09:03:09 -04:00
|
|
|
|
An exception will now be raised if more than one argument is used.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Extension modules
|
|
|
|
|
|
2002-06-14 18:31:18 -03:00
|
|
|
|
- The 'new' module is no longer an extension, but a Python module that
|
|
|
|
|
only exists for backwards compatibility. Its contents are no longer
|
|
|
|
|
functions but callable type objects.
|
|
|
|
|
|
2002-04-28 22:37:32 -03:00
|
|
|
|
- The bsddb.*open functions can now take 'None' as a filename.
|
2002-04-22 23:11:05 -03:00
|
|
|
|
This will create a temporary in-memory bsddb that won't be
|
2002-04-28 22:37:32 -03:00
|
|
|
|
written to disk.
|
2002-04-22 23:11:05 -03:00
|
|
|
|
|
2002-06-13 18:09:11 -03:00
|
|
|
|
- posix.killpg, posix.mknod, and posix.getpgid have been added where
|
|
|
|
|
available.
|
2002-04-14 07:19:44 -03:00
|
|
|
|
|
2002-03-27 14:49:02 -04:00
|
|
|
|
- The locale module now exposes the C library's gettext interface.
|
|
|
|
|
|
2002-03-14 15:06:01 -04:00
|
|
|
|
- A security hole ("double free") was found in zlib-1.1.3, a popular
|
|
|
|
|
third party compression library used by some Python modules. The
|
|
|
|
|
hole was quickly plugged in zlib-1.1.4, and the Windows build of
|
|
|
|
|
Python now ships with zlib-1.1.4.
|
|
|
|
|
|
2002-04-08 18:28:20 -03:00
|
|
|
|
- pwd, grp, and resource return enhanced tuples now, with symbolic
|
|
|
|
|
field names.
|
2002-03-01 06:47:37 -04:00
|
|
|
|
|
2002-03-01 06:27:01 -04:00
|
|
|
|
- array.array is now a type object. A new format character
|
|
|
|
|
'u' indicates Py_UNICODE arrays. For those, .tounicode and
|
|
|
|
|
.fromunicode methods are available. Arrays now support __iadd__
|
|
|
|
|
and __imul__.
|
|
|
|
|
|
2002-01-01 17:14:12 -04:00
|
|
|
|
- dl now builds on every system that has dlfcn.h. Failure in case
|
2002-01-01 16:18:30 -04:00
|
|
|
|
of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
|
|
|
|
|
is called.
|
|
|
|
|
|
2002-05-27 12:08:24 -03:00
|
|
|
|
- signal.sigpending, signal.sigprocmask and signal.sigsuspend have
|
|
|
|
|
been added where available.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Library
|
|
|
|
|
|
2002-07-07 00:59:34 -03:00
|
|
|
|
- binascii.crc32() and the zipfile module had problems on some 64-bit
|
|
|
|
|
platforms. These have been fixed. On a platform with 8-byte C longs,
|
|
|
|
|
crc32() now returns a signed-extended 4-byte result, so that its value
|
|
|
|
|
as a Python int is equal to the value computed a 32-bit platform.
|
|
|
|
|
|
2002-06-30 12:05:00 -03:00
|
|
|
|
- xml.dom.minidom.toxml and toprettyxml now take an optional encoding
|
|
|
|
|
argument.
|
|
|
|
|
|
2002-06-10 18:39:42 -03:00
|
|
|
|
- Some fixes in the copy module: when an object is copied through its
|
|
|
|
|
__reduce__ method, there was no check for a __setstate__ method on
|
|
|
|
|
the result [SF patch 565085]; deepcopy should treat instances of
|
|
|
|
|
custom metaclasses the same way it treats instances of type 'type'
|
|
|
|
|
[SF patch 560794].
|
|
|
|
|
|
2002-06-07 09:40:52 -03:00
|
|
|
|
- Sockets now support timeout mode. After s.settimeout(T), where T is
|
|
|
|
|
a float expressing seconds, subsequent operations raise an exception
|
|
|
|
|
if they cannot be completed within T seconds. To disable timeout
|
|
|
|
|
mode, use s.settimeout(None).
|
|
|
|
|
|
|
|
|
|
- getopt.gnu_getopt was added. This supports GNU-style option
|
|
|
|
|
processing, where options can be mixed with non-option arguments.
|
2002-06-06 07:58:36 -03:00
|
|
|
|
|
2002-06-04 15:27:35 -03:00
|
|
|
|
- Stop using strings for exceptions. String objects used for
|
|
|
|
|
exceptions are now classes deriving from Exception. The objects
|
|
|
|
|
changed were: Tkinter.TclError, bdb.BdbQuit, macpath.norm_error,
|
|
|
|
|
tabnanny.NannyNag, and xdrlib.Error.
|
2002-06-04 14:14:07 -03:00
|
|
|
|
|
2002-06-04 12:16:29 -03:00
|
|
|
|
- Constants BOM_UTF8, BOM_UTF16, BOM_UTF16_LE, BOM_UTF16_BE,
|
|
|
|
|
BOM_UTF32, BOM_UTF32_LE and BOM_UTF32_BE that represent the Byte
|
|
|
|
|
Order Mark in UTF-8, UTF-16 and UTF-32 encodings for little and
|
|
|
|
|
big endian systems were added to the codecs module. The old names
|
|
|
|
|
BOM32_* and BOM64_* were off by a factor of 2.
|
|
|
|
|
|
2002-06-18 17:43:18 -03:00
|
|
|
|
- Added conversion functions math.degrees() and math.radians().
|
2002-05-13 01:17:32 -03:00
|
|
|
|
|
2002-05-12 03:07:21 -03:00
|
|
|
|
- ftplib.retrlines() now tests for callback is None rather than testing
|
|
|
|
|
for False. Was causing an error when given a callback object which
|
|
|
|
|
was callable but also returned len() as zero. The change may
|
|
|
|
|
create new breakage if the caller relied on the undocumented behavior
|
|
|
|
|
and called with callback set to [] or some other False value not
|
|
|
|
|
identical to None.
|
|
|
|
|
|
2002-05-05 17:40:00 -03:00
|
|
|
|
- random.gauss() uses a piece of hidden state used by nothing else,
|
|
|
|
|
and the .seed() and .whseed() methods failed to reset it. In other
|
|
|
|
|
words, setting the seed didn't completely determine the sequence of
|
|
|
|
|
results produced by random.gauss(). It does now. Programs repeatedly
|
|
|
|
|
mixing calls to a seed method with calls to gauss() may see different
|
|
|
|
|
results now.
|
|
|
|
|
|
2002-05-01 17:33:53 -03:00
|
|
|
|
- The pickle.Pickler class grew a clear_memo() method to mimic that
|
|
|
|
|
provided by cPickle.Pickler.
|
|
|
|
|
|
2002-04-28 22:37:32 -03:00
|
|
|
|
- difflib's SequenceMatcher class now does a dynamic analysis of
|
|
|
|
|
which elements are so frequent as to constitute noise. For
|
|
|
|
|
comparing files as sequences of lines, this generally works better
|
|
|
|
|
than the IS_LINE_JUNK function, and function ndiff's linejunk
|
|
|
|
|
argument defaults to None now as a result. A happy benefit is
|
|
|
|
|
that SequenceMatcher may run much faster now when applied
|
|
|
|
|
to large files with many duplicate lines (for example, C program
|
|
|
|
|
text with lots of repeated "}" and "return NULL;" lines).
|
|
|
|
|
|
2002-04-23 10:29:43 -03:00
|
|
|
|
- New Text.dump() method in Tkinter module.
|
|
|
|
|
|
2002-04-17 17:33:40 -03:00
|
|
|
|
- New distutils commands for building packagers were added to
|
|
|
|
|
support pkgtool on Solaris and swinstall on HP-UX.
|
|
|
|
|
|
|
|
|
|
- distutils now has a new abstract binary packager base class
|
|
|
|
|
command/bdist_packager, which simplifies writing packagers.
|
|
|
|
|
This will hopefully provide the missing bits to encourage
|
|
|
|
|
people to submit more packagers, e.g. for Debian, FreeBSD
|
|
|
|
|
and other systems.
|
|
|
|
|
|
2002-06-18 17:43:18 -03:00
|
|
|
|
- The UTF-16, -LE and -BE stream readers now raise a
|
|
|
|
|
NotImplementedError for all calls to .readline(). Previously, they
|
|
|
|
|
used to just produce garbage or fail with an encoding error --
|
|
|
|
|
UTF-16 is a 2-byte encoding and the C lib's line reading APIs don't
|
2002-04-05 08:15:05 -04:00
|
|
|
|
work well with these.
|
|
|
|
|
|
2002-03-18 08:44:08 -04:00
|
|
|
|
- compileall now supports quiet operation.
|
|
|
|
|
|
2002-05-07 17:58:03 -03:00
|
|
|
|
- The BaseHTTPServer now implements optional HTTP/1.1 persistent
|
2002-03-17 14:37:22 -04:00
|
|
|
|
connections.
|
|
|
|
|
|
2002-02-16 14:23:30 -04:00
|
|
|
|
- socket module: the SSL support was broken out of the main
|
|
|
|
|
_socket module C helper and placed into a new _ssl helper
|
|
|
|
|
which now gets imported by socket.py if available and working.
|
|
|
|
|
|
2002-02-10 17:42:47 -04:00
|
|
|
|
- encodings package: added aliases for all supported IANA character
|
|
|
|
|
sets
|
|
|
|
|
|
2001-12-28 16:57:14 -04:00
|
|
|
|
- ftplib: to safeguard the user's privacy, anonymous login will use
|
|
|
|
|
"anonymous@" as default password, rather than the real user and host
|
|
|
|
|
name.
|
|
|
|
|
|
2002-01-10 09:50:31 -04:00
|
|
|
|
- webbrowser: tightened up the command passed to os.system() so that
|
|
|
|
|
arbitrary shell code can't be executed because a bogus URL was
|
|
|
|
|
passed in.
|
|
|
|
|
|
2002-01-31 20:52:29 -04:00
|
|
|
|
- gettext.translation has an optional fallback argument, and
|
2002-01-11 02:58:49 -04:00
|
|
|
|
gettext.find an optional all argument. Translations will now fallback
|
|
|
|
|
on a per-message basis.
|
2002-01-11 02:33:28 -04:00
|
|
|
|
|
2002-01-12 07:27:42 -04:00
|
|
|
|
- distutils bdist commands now offer a --skip-build option.
|
|
|
|
|
|
2002-03-21 06:38:40 -04:00
|
|
|
|
- warnings.warn now accepts a Warning instance as first argument.
|
|
|
|
|
|
2002-04-04 15:36:15 -04:00
|
|
|
|
- The xml.sax.expatreader.ExpatParser class will no longer create
|
|
|
|
|
circular references by using itself as the locator that gets passed
|
|
|
|
|
to the content handler implementation. [SF bug #535474]
|
|
|
|
|
|
2002-05-19 21:14:24 -03:00
|
|
|
|
- The email.Parser.Parser class now properly parses strings regardless
|
|
|
|
|
of their line endings, which can be any of \r, \n, or \r\n (CR, LF,
|
|
|
|
|
or CRLF). Also, the Header class's constructor default arguments
|
|
|
|
|
has changed slightly so that an explicit maxlinelen value is always
|
|
|
|
|
honored.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Tools/Demos
|
|
|
|
|
|
2002-04-04 12:17:11 -04:00
|
|
|
|
- freeze.py now produces binaries which can import shared modules,
|
|
|
|
|
unlike before when this failed due to missing symbol exports in
|
|
|
|
|
the generated binary.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Build
|
|
|
|
|
|
2002-07-08 19:11:52 -03:00
|
|
|
|
- A bug was fixed that could cause COUNT_ALLOCS builds to segfault, or
|
|
|
|
|
get into infinite loops, when a new-style class got garbage-collected.
|
|
|
|
|
Unfortunately, to avoid this, the way COUNT_ALLOCS works requires
|
|
|
|
|
that new-style classes be immortal in COUNT_ALLOCS builds. Note that
|
|
|
|
|
COUNT_ALLOCS is not enabled by default, in either release or debug
|
|
|
|
|
builds, and that new-style classes are immortal only in COUNT_ALLOCS
|
|
|
|
|
builds.
|
|
|
|
|
|
2002-07-07 00:59:34 -03:00
|
|
|
|
- Compiling out the cyclic garbage collector is no longer an option.
|
|
|
|
|
The old symbol WITH_CYCLE_GC is now ignored, and Python.h arranges
|
|
|
|
|
that it's always defined (for the benefit of any extension modules
|
|
|
|
|
that may be conditionalizing on it). A bonus is that any extension
|
|
|
|
|
type participating in cyclic gc can choose to participate in the
|
|
|
|
|
Py_TRASHCAN mechanism now too; in the absence of cyclic gc, this used
|
|
|
|
|
to require editing the core to teach the trashcan mechanism about the
|
|
|
|
|
new type.
|
|
|
|
|
|
2002-07-03 00:31:20 -03:00
|
|
|
|
- Accoring to Annex F of the current C standard,
|
|
|
|
|
|
|
|
|
|
The Standard C macro HUGE_VAL and its float and long double analogs,
|
|
|
|
|
HUGE_VALF and HUGE_VALL, expand to expressions whose values are
|
|
|
|
|
positive infinities.
|
|
|
|
|
|
|
|
|
|
Python only uses the double HUGE_VAL, and only to #define its own symbol
|
|
|
|
|
Py_HUGE_VAL. Some platforms have incorrect definitions for HUGE_VAL.
|
|
|
|
|
pyport.h used to try to worm around that, but the workarounds triggered
|
|
|
|
|
other bugs on other platforms, so we gave up. If your platform defines
|
|
|
|
|
HUGE_VAL incorrectly, you'll need to #define Py_HUGE_VAL to something
|
|
|
|
|
that works on your platform. The only instance of this I'm sure about
|
|
|
|
|
is on an unknown subset of Cray systems, described here:
|
|
|
|
|
|
|
|
|
|
http://www.cray.com/swpubs/manuals/SN-2194_2.0/html-SN-2194_2.0/x3138.htm
|
|
|
|
|
|
|
|
|
|
Presumably 2.3a1 breaks such systems. If anyone uses such a system, help!
|
|
|
|
|
|
2002-06-09 10:33:54 -03:00
|
|
|
|
- The configure option --without-doc-strings can be used to remove the
|
|
|
|
|
doc strings from the builtin functions and modules; this reduces the
|
|
|
|
|
size of the executable.
|
|
|
|
|
|
2002-04-21 04:30:30 -03:00
|
|
|
|
- XXX WITH_UNIVERSAL_NEWLINES Somebody fill this in; the PEP doesn't
|
|
|
|
|
say how or when to configure it, or how to turn it off.
|
|
|
|
|
|
2002-03-29 12:28:31 -04:00
|
|
|
|
- On Unix, a shared libpython2.3.so can be created with --enable-shared.
|
|
|
|
|
|
2002-03-30 06:06:07 -04:00
|
|
|
|
- All uses of the CACHE_HASH, INTERN_STRINGS, and DONT_SHARE_SHORT_STRINGS
|
|
|
|
|
preprocessor symbols were eliminated. The internal decisions they
|
|
|
|
|
controlled stopped being experimental long ago.
|
2002-03-28 23:29:08 -04:00
|
|
|
|
|
2002-05-02 18:17:00 -03:00
|
|
|
|
- The tools used to build the documentation now work under Cygwin as
|
|
|
|
|
well as Unix.
|
|
|
|
|
|
2002-06-14 17:30:31 -03:00
|
|
|
|
- The bsddb and dbm module builds have been changed to try and avoid version
|
|
|
|
|
skew problems and disable linkage with Berkeley DB 1.85 unless the
|
|
|
|
|
installer knows what s/he's doing. See the section on building these
|
|
|
|
|
modules in the README file for details.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
C API
|
|
|
|
|
|
2002-05-08 05:44:21 -03:00
|
|
|
|
- Added new macro PySequence_ITEM(o, i) that directly calls
|
|
|
|
|
sq_item without rechecking that o is a sequence and without
|
|
|
|
|
adjusting for negative indices.
|
|
|
|
|
|
2002-05-02 18:28:26 -03:00
|
|
|
|
- PyRange_New() now raises ValueError if the fourth argument is not 1.
|
|
|
|
|
This is part of the removal of deprecated features of the xrange
|
|
|
|
|
object.
|
|
|
|
|
|
2002-04-25 23:49:14 -03:00
|
|
|
|
- PyNumber_Coerce() and PyNumber_CoerceEx() now also invoke the type's
|
|
|
|
|
coercion if both arguments have the same type but this type has the
|
|
|
|
|
CHECKTYPES flag set. This is to better support proxies.
|
|
|
|
|
|
2002-04-12 20:00:08 -03:00
|
|
|
|
- The type of tp_free has been changed from "void (*)(PyObject *)" to
|
|
|
|
|
"void (*)(void *)".
|
|
|
|
|
|
|
|
|
|
- PyObject_Del, PyObject_GC_Del are now functions instead of macros.
|
|
|
|
|
|
2002-04-07 22:38:42 -03:00
|
|
|
|
- A type can now inherit its metatype from its base type. Previously,
|
|
|
|
|
when PyType_Ready() was called, if ob_type was found to be NULL, it
|
|
|
|
|
was always set to &PyType_Type; now it is set to base->ob_type,
|
|
|
|
|
where base is tp_base, defaulting to &PyObject_Type.
|
|
|
|
|
|
|
|
|
|
- PyType_Ready() accidentally did not inherit tp_is_gc; now it does.
|
|
|
|
|
|
2002-05-08 11:14:41 -03:00
|
|
|
|
- The PyCore_* family of APIs have been removed.
|
2002-03-22 13:06:59 -04:00
|
|
|
|
|
2002-05-07 17:58:03 -03:00
|
|
|
|
- The "u#" parser marker will now pass through Unicode objects as-is
|
2002-01-09 12:21:27 -04:00
|
|
|
|
without going through the buffer API.
|
|
|
|
|
|
2002-01-01 15:59:11 -04:00
|
|
|
|
- The enumerators of cmp_op have been renamed to use the prefix PyCmp_.
|
|
|
|
|
|
2001-12-25 15:07:38 -04:00
|
|
|
|
- An old #define of ANY as void has been removed from pyport.h. This
|
|
|
|
|
hasn't been used since Python's pre-ANSI days, and the #define has
|
|
|
|
|
been marked as obsolete since then. SF bug 495548 says it created
|
|
|
|
|
conflicts with other packages, so keeping it around wasn't harmless.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
- Because Python's magic number scheme broke on January 1st, we decided
|
|
|
|
|
to stop Python development. Thanks for all the fish!
|
|
|
|
|
|
2002-03-10 20:24:00 -04:00
|
|
|
|
- Some of us don't like fish, so we changed Python's magic number
|
2002-02-09 07:28:43 -04:00
|
|
|
|
scheme to a new one. See Python/import.c for details.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
New platforms
|
|
|
|
|
|
2002-06-11 03:22:31 -03:00
|
|
|
|
- AtheOS is now supported.
|
|
|
|
|
|
2002-01-01 14:41:33 -04:00
|
|
|
|
- GNU/Hurd is now supported.
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
Windows
|
|
|
|
|
|
2002-04-16 17:48:01 -03:00
|
|
|
|
- Sometimes the uninstall executable (UNWISE.EXE) vanishes. One cause
|
|
|
|
|
of that has been fixed in the installer (disabled Wise's "delete in-
|
|
|
|
|
use files" uninstall option).
|
|
|
|
|
|
2002-04-05 20:23:25 -04:00
|
|
|
|
- Fixed a bug in urllib's proxy handling in Windows. [SF bug #503031]
|
|
|
|
|
|
2002-04-04 16:02:04 -04:00
|
|
|
|
- The installer now installs Start menu shortcuts under (the local
|
|
|
|
|
equivalent of) "All Users" when doing an Admin install.
|
|
|
|
|
|
2002-03-10 20:24:00 -04:00
|
|
|
|
- file.truncate([newsize]) now works on Windows for all newsize values.
|
|
|
|
|
It used to fail if newsize didn't fit in 32 bits, reflecting a
|
|
|
|
|
limitation of MS _chsize (which is no longer used).
|
|
|
|
|
|
2002-02-01 07:27:43 -04:00
|
|
|
|
- os.waitpid() is now implemented for Windows, and can be used to block
|
|
|
|
|
until a specified process exits. This is similar to, but not exactly
|
|
|
|
|
the same as, os.waitpid() on POSIX systems. If you're waiting for
|
|
|
|
|
a specific process whose pid was obtained from one of the spawn()
|
|
|
|
|
functions, the same Python os.waitpid() code works across platforms.
|
2002-04-04 16:02:04 -04:00
|
|
|
|
See the docs for details. The docs were changed to clarify that
|
|
|
|
|
spawn functions return, and waitpid requires, a process handle on
|
|
|
|
|
Windows (not the same thing as a Windows process id).
|
2002-02-01 07:27:43 -04:00
|
|
|
|
|
2002-01-31 20:52:29 -04:00
|
|
|
|
- New tempfile.TemporaryFile implementation for Windows: this doesn't
|
2002-05-07 17:58:03 -03:00
|
|
|
|
need a TemporaryFileWrapper wrapper anymore, and should be immune
|
2002-01-31 20:52:29 -04:00
|
|
|
|
to a nasty problem: before 2.3, if you got a temp file on Windows, it
|
|
|
|
|
got wrapped in an object whose close() method first closed the
|
|
|
|
|
underlying file, then deleted the file. This usually worked fine.
|
|
|
|
|
However, the spawn family of functions on Windows create (at a low C
|
|
|
|
|
level) the same set of open files in the spawned process Q as were
|
|
|
|
|
open in the spawning process P. If a temp file f was among them, then
|
|
|
|
|
doing f.close() in P first closed P's C-level file handle on f, but Q's
|
|
|
|
|
C-level file handle on f remained open, so the attempt in P to delete f
|
|
|
|
|
blew up with a "Permission denied" error (Windows doesn't allow
|
|
|
|
|
deleting open files). This was surprising, subtle, and difficult to
|
|
|
|
|
work around.
|
|
|
|
|
|
|
|
|
|
- The os module now exports all the symbolic constants usable with the
|
|
|
|
|
low-level os.open() on Windows: the new constants in 2.3 are
|
|
|
|
|
O_NOINHERIT, O_SHORT_LIVED, O_TEMPORARY, O_RANDOM and O_SEQUENTIAL.
|
|
|
|
|
The others were also available in 2.2: O_APPEND, O_BINARY, O_CREAT,
|
|
|
|
|
O_EXCL, O_RDONLY, O_RDWR, O_TEXT, O_TRUNC and O_WRONLY. Contrary
|
|
|
|
|
to Microsoft docs, O_SHORT_LIVED does not seem to imply O_TEMPORARY
|
|
|
|
|
(so specify both if you want both; note that neither is useful unless
|
|
|
|
|
specified with O_CREAT too).
|
|
|
|
|
|
2001-12-21 17:36:50 -04:00
|
|
|
|
Mac
|
|
|
|
|
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
What's New in Python 2.2 final?
|
|
|
|
|
Release date: 21-Dec-2001
|
|
|
|
|
===============================
|
|
|
|
|
|
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- pickle.py, cPickle: allow pickling instances of new-style classes
|
|
|
|
|
with a custom metaclass.
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
Core and builtins
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- weakref proxy object: when comparing, unwrap both arguments if both
|
|
|
|
|
are proxies.
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
Extension modules
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- binascii.b2a_base64(): fix a potential buffer overrun when encoding
|
|
|
|
|
very short strings.
|
|
|
|
|
|
|
|
|
|
- cPickle: the obscure "fast" mode was suspected of causing stack
|
|
|
|
|
overflows on the Mac. Hopefully fixed this by setting the recursion
|
|
|
|
|
limit much smaller. If the limit is too low (it only affects
|
|
|
|
|
performance), you can change it by defining PY_CPICKLE_FAST_LIMIT
|
|
|
|
|
when compiling cPickle.c (or in pyconfig.h).
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
Library
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- dumbdbm.py: fixed a dumb old bug (the file didn't get synched at
|
|
|
|
|
close or delete time).
|
|
|
|
|
|
|
|
|
|
- rfc822.py: fixed a bug where the address '<>' was converted to None
|
|
|
|
|
instead of an empty string (also fixes the email.Utils module).
|
|
|
|
|
|
|
|
|
|
- xmlrpclib.py: version 1.0.0; uses precision for doubles.
|
|
|
|
|
|
|
|
|
|
- test suite: the pickle and cPickle tests were not executing any code
|
2002-05-07 17:58:03 -03:00
|
|
|
|
when run from the standard regression test.
|
2001-12-21 16:04:22 -04:00
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
Tools/Demos
|
|
|
|
|
|
|
|
|
|
Build
|
|
|
|
|
|
|
|
|
|
C API
|
|
|
|
|
|
|
|
|
|
New platforms
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
Windows
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- distutils package: fixed broken Windows installers (bdist_wininst).
|
|
|
|
|
|
|
|
|
|
- tempfile.py: prevent mysterious warnings when TemporaryFileWrapper
|
|
|
|
|
instances are deleted at process exit time.
|
|
|
|
|
|
|
|
|
|
- socket.py: prevent mysterious warnings when socket instances are
|
|
|
|
|
deleted at process exit time.
|
|
|
|
|
|
|
|
|
|
- posixmodule.c: fix a Windows crash with stat() of a filename ending
|
|
|
|
|
in backslash.
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
Mac
|
|
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
|
- The Carbon toolbox modules have been upgraded to Universal Headers
|
|
|
|
|
3.4, and experimental CoreGraphics and CarbonEvents modules have
|
|
|
|
|
been added. All only for framework-enabled MacOSX.
|
|
|
|
|
|
2001-12-14 19:16:18 -04:00
|
|
|
|
|
2001-12-13 15:34:00 -04:00
|
|
|
|
What's New in Python 2.2c1?
|
|
|
|
|
Release date: 14-Dec-2001
|
2001-11-16 20:21:57 -04:00
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
2001-12-14 16:47:12 -04:00
|
|
|
|
- Guido's tutorial introduction to the new type/class features has
|
|
|
|
|
been extensively updated. See
|
|
|
|
|
|
|
|
|
|
http://www.python.org/2.2/descrintro.html
|
|
|
|
|
|
|
|
|
|
That remains the primary documentation in this area.
|
|
|
|
|
|
2001-12-05 18:45:48 -04:00
|
|
|
|
- Fixed a leak: instance variables declared with __slots__ were never
|
|
|
|
|
deleted!
|
|
|
|
|
|
2001-12-02 20:54:52 -04:00
|
|
|
|
- The "delete attribute" method of descriptor objects is called
|
|
|
|
|
__delete__, not __del__. In previous releases, it was mistakenly
|
|
|
|
|
called __del__, which created an unfortunate overloading condition
|
|
|
|
|
with finalizers. (The "get attribute" and "set attribute" methods
|
|
|
|
|
are still called __get__ and __set__, respectively.)
|
|
|
|
|
|
2001-12-03 11:46:59 -04:00
|
|
|
|
- Some subtle issues with the super built-in were fixed:
|
|
|
|
|
|
|
|
|
|
(a) When super itself is subclassed, its __get__ method would still
|
|
|
|
|
return an instance of the base class (i.e., of super).
|
|
|
|
|
|
|
|
|
|
(b) super(C, C()).__class__ would return C rather than super. This
|
|
|
|
|
is confusing. To fix this, I decided to change the semantics of
|
|
|
|
|
super so that it only applies to code attributes, not to data
|
|
|
|
|
attributes. After all, overriding data attributes is not
|
|
|
|
|
supported anyway.
|
|
|
|
|
|
|
|
|
|
(c) The __get__ method didn't check whether the argument was an
|
|
|
|
|
instance of the type used in creation of the super instance.
|
|
|
|
|
|
2001-12-04 17:02:07 -04:00
|
|
|
|
- Previously, hash() of an instance of a subclass of a mutable type
|
|
|
|
|
(list or dictionary) would return some value, rather than raising
|
|
|
|
|
TypeError. This has been fixed. Also, directly calling
|
|
|
|
|
dict.__hash__ and list.__hash__ now raises the same TypeError
|
|
|
|
|
(previously, these were the same as object.__hash__).
|
2001-12-03 11:46:59 -04:00
|
|
|
|
|
2001-12-05 15:46:42 -04:00
|
|
|
|
- New-style objects now support deleting their __dict__. This is for
|
|
|
|
|
all intents and purposes equivalent to assigning a brand new empty
|
|
|
|
|
dictionary, but saves space if the object is not used further.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
Core and builtins
|
|
|
|
|
|
2001-12-06 02:23:26 -04:00
|
|
|
|
- -Qnew now works as documented in PEP 238: when -Qnew is passed on
|
|
|
|
|
the command line, all occurrences of "/" use true division instead
|
|
|
|
|
of classic division. See the PEP for details. Note that "all"
|
|
|
|
|
means all instances in library and 3rd-party modules, as well as in
|
|
|
|
|
your own code. As the PEP says, -Qnew is intended for use only in
|
|
|
|
|
educational environments with control over the libraries in use.
|
2001-12-11 17:43:14 -04:00
|
|
|
|
Note that test_coercion.py in the standard Python test suite fails
|
|
|
|
|
under -Qnew; this is expected, and won't be repaired until true
|
|
|
|
|
division becomes the default (in the meantime, test_coercion is
|
|
|
|
|
testing the current rules).
|
2001-12-06 02:23:26 -04:00
|
|
|
|
|
2001-12-14 13:08:12 -04:00
|
|
|
|
- complex() now only allows the first argument to be a string
|
|
|
|
|
argument, and raises TypeError if either the second arg is a string
|
|
|
|
|
or if the second arg is specified when the first is a string.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
Extension modules
|
|
|
|
|
|
2001-11-24 05:24:51 -04:00
|
|
|
|
- gc.get_referents was renamed to gc.get_referrers.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
Library
|
|
|
|
|
|
2001-12-07 16:35:43 -04:00
|
|
|
|
- Functions in the os.spawn() family now release the global interpreter
|
|
|
|
|
lock around calling the platform spawn. They should always have done
|
|
|
|
|
this, but did not before 2.2c1. Multithreaded programs calling
|
|
|
|
|
an os.spawn function with P_WAIT will no longer block all Python threads
|
|
|
|
|
until the spawned program completes. It's possible that some programs
|
|
|
|
|
relies on blocking, although more likely by accident than by design.
|
|
|
|
|
|
2001-11-25 10:35:58 -04:00
|
|
|
|
- webbrowser defaults to netscape.exe on OS/2 now.
|
|
|
|
|
|
2001-11-25 10:50:56 -04:00
|
|
|
|
- Tix.ResizeHandle exposes detach_widget, hide, and show.
|
|
|
|
|
|
2001-12-02 08:26:03 -04:00
|
|
|
|
- The charset alias windows_1252 has been added.
|
|
|
|
|
|
2001-12-14 16:47:12 -04:00
|
|
|
|
- types.StringTypes is a tuple containing the defined string types;
|
|
|
|
|
usually this will be (str, unicode), but if Python was compiled
|
|
|
|
|
without Unicode support it will be just (str,).
|
|
|
|
|
|
|
|
|
|
- The pulldom and minidom modules were synchronized to PyXML.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
Tools/Demos
|
|
|
|
|
|
2001-12-14 16:47:12 -04:00
|
|
|
|
- A new script called Tools/scripts/google.py was added, which fires
|
|
|
|
|
off a search on Google.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
Build
|
|
|
|
|
|
2001-12-14 16:47:12 -04:00
|
|
|
|
- Note that release builds of Python should arrange to define the
|
|
|
|
|
preprocessor symbol NDEBUG on the command line (or equivalent).
|
|
|
|
|
In the 2.2 pre-release series we tried to define this by magic in
|
|
|
|
|
Python.h instead, but it proved to cause problems for extension
|
|
|
|
|
authors. The Unix, Windows and Mac builds now all define NDEBUG in
|
|
|
|
|
release builds via cmdline (or equivalent) instead. Ports to
|
|
|
|
|
other platforms should do likewise.
|
|
|
|
|
|
2001-12-06 17:47:20 -04:00
|
|
|
|
- It is no longer necessary to use --with-suffix when building on a
|
|
|
|
|
case-insensitive file system (such as Mac OS X HFS+). In the build
|
|
|
|
|
directory an extension is used, but not in the installed python.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
C API
|
|
|
|
|
|
2001-12-11 14:51:08 -04:00
|
|
|
|
- New function PyDict_MergeFromSeq2() exposes the builtin dict
|
|
|
|
|
constructor's logic for updating a dictionary from an iterable object
|
|
|
|
|
producing key-value pairs.
|
|
|
|
|
|
2001-11-28 23:26:37 -04:00
|
|
|
|
- PyArg_ParseTupleAndKeywords() requires that the number of entries in
|
2001-12-11 14:51:08 -04:00
|
|
|
|
the keyword list equal the number of argument specifiers. This
|
2001-11-28 23:26:37 -04:00
|
|
|
|
wasn't checked correctly, and PyArg_ParseTupleAndKeywords could even
|
|
|
|
|
dump core in some bad cases. This has been repaired. As a result,
|
|
|
|
|
PyArg_ParseTupleAndKeywords may raise RuntimeError in bad cases that
|
|
|
|
|
previously went unchallenged.
|
|
|
|
|
|
2001-11-16 20:21:57 -04:00
|
|
|
|
New platforms
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
Windows
|
|
|
|
|
|
|
|
|
|
Mac
|
|
|
|
|
|
2001-12-06 17:14:00 -04:00
|
|
|
|
- In unix-Python on Mac OS X (and darwin) sys.platform is now "darwin",
|
|
|
|
|
without any trailing digits.
|
2001-11-16 20:21:57 -04:00
|
|
|
|
|
2001-12-14 16:47:12 -04:00
|
|
|
|
- Changed logic for finding python home in Mac OS X framework Pythons.
|
|
|
|
|
Now sys.executable points to the executable again, in stead of to
|
|
|
|
|
the shared library. The latter is used only for locating the python
|
|
|
|
|
home.
|
|
|
|
|
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
What's New in Python 2.2b2?
|
2001-11-15 16:02:21 -04:00
|
|
|
|
Release date: 16-Nov-2001
|
2001-10-19 14:55:30 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
2001-11-15 16:27:54 -04:00
|
|
|
|
- Multiple inheritance mixing new-style and classic classes in the
|
|
|
|
|
list of base classes is now allowed, so this works now:
|
2001-11-15 16:02:21 -04:00
|
|
|
|
|
|
|
|
|
class Classic: pass
|
2001-11-15 16:27:54 -04:00
|
|
|
|
class Mixed(Classic, object): pass
|
2001-11-15 16:02:21 -04:00
|
|
|
|
|
|
|
|
|
The MRO (method resolution order) for each base class is respected
|
|
|
|
|
according to its kind, but the MRO for the derived class is computed
|
2002-05-07 17:58:03 -03:00
|
|
|
|
using new-style MRO rules if any base class is a new-style class.
|
2001-11-15 16:02:21 -04:00
|
|
|
|
This needs to be documented.
|
|
|
|
|
|
2001-10-29 18:25:45 -04:00
|
|
|
|
- The new builtin dictionary() constructor, and dictionary type, have
|
|
|
|
|
been renamed to dict. This reflects a decade of common usage.
|
|
|
|
|
|
2001-11-15 16:33:10 -04:00
|
|
|
|
- dict() now accepts an iterable object producing 2-sequences. For
|
|
|
|
|
example, dict(d.items()) == d for any dictionary d. The argument,
|
|
|
|
|
and the elements of the argument, can be any iterable objects.
|
|
|
|
|
|
2001-10-29 18:11:00 -04:00
|
|
|
|
- New-style classes can now have a __del__ method, which is called
|
|
|
|
|
when the instance is deleted (just like for classic classes).
|
|
|
|
|
|
2001-10-26 11:56:06 -03:00
|
|
|
|
- Assignment to object.__dict__ is now possible, for objects that are
|
|
|
|
|
instances of new-style classes that have a __dict__ (unless the base
|
|
|
|
|
class forbids it).
|
|
|
|
|
|
2001-10-21 21:43:43 -03:00
|
|
|
|
- Methods of built-in types now properly check for keyword arguments
|
|
|
|
|
(formerly these were silently ignored). The only built-in methods
|
|
|
|
|
that take keyword arguments are __call__, __init__ and __new__.
|
|
|
|
|
|
2001-10-27 19:28:54 -03:00
|
|
|
|
- The socket function has been converted to a type; see below.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Core and builtins
|
|
|
|
|
|
2001-11-09 17:06:24 -04:00
|
|
|
|
- Assignment to __debug__ raises SyntaxError at compile-time. This
|
|
|
|
|
was promised when 2.1c1 was released as "What's New in Python 2.1c1"
|
2001-11-16 12:17:27 -04:00
|
|
|
|
(see below) says.
|
2001-11-09 17:06:24 -04:00
|
|
|
|
|
2001-10-26 11:56:06 -03:00
|
|
|
|
- Clarified the error messages for unsupported operands to an operator
|
|
|
|
|
(like 1 + '').
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Extension modules
|
|
|
|
|
|
2001-11-13 19:11:19 -04:00
|
|
|
|
- mmap has a new keyword argument, "access", allowing a uniform way for
|
|
|
|
|
both Windows and Unix users to create read-only, write-through and
|
|
|
|
|
copy-on-write memory mappings. This was previously possible only on
|
|
|
|
|
Unix. A new keyword argument was required to support this in a
|
2002-05-07 17:58:03 -03:00
|
|
|
|
uniform way because the mmap() signatures had diverged across
|
2001-11-13 19:11:19 -04:00
|
|
|
|
platforms. Thanks to Jay T Miller for repairing this!
|
|
|
|
|
|
2001-11-03 15:57:21 -04:00
|
|
|
|
- By default, the gc.garbage list now contains only those instances in
|
|
|
|
|
unreachable cycles that have __del__ methods; in 2.1 it contained all
|
|
|
|
|
instances in unreachable cycles. "Instances" here has been generalized
|
|
|
|
|
to include instances of both new-style and old-style classes.
|
|
|
|
|
|
2001-10-26 11:56:06 -03:00
|
|
|
|
- The socket module defines a new method for socket objects,
|
|
|
|
|
sendall(). This is like send() but may make multiple calls to
|
2001-10-27 19:28:54 -03:00
|
|
|
|
send() until all data has been sent. Also, the socket function has
|
|
|
|
|
been converted to a subclassable type, like list and tuple (etc.)
|
|
|
|
|
before it; socket and SocketType are now the same thing.
|
2001-10-26 11:56:06 -03:00
|
|
|
|
|
|
|
|
|
- Various bugfixes to the curses module. There is now a test suite
|
|
|
|
|
for the curses module (you have to run it manually).
|
2001-10-22 13:37:10 -03:00
|
|
|
|
|
2001-10-29 23:03:03 -04:00
|
|
|
|
- binascii.b2a_base64 no longer places an arbitrary restriction of 57
|
|
|
|
|
bytes on its input.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Library
|
|
|
|
|
|
2001-11-13 19:11:19 -04:00
|
|
|
|
- tkFileDialog exposes a Directory class and askdirectory
|
2001-11-07 18:38:08 -04:00
|
|
|
|
convenience function.
|
|
|
|
|
|
2001-11-03 15:35:43 -04:00
|
|
|
|
- Symbolic group names in regular expressions must be unique. For
|
|
|
|
|
example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
|
|
|
|
|
single name can't mean both "group 1" and "group 2" simultaneously.
|
2001-11-16 12:17:27 -04:00
|
|
|
|
Python 2.2 detects this error at regexp compilation time;
|
|
|
|
|
previously, the error went undetected, and results were
|
|
|
|
|
unpredictable. Also in sre, the pattern.split(), pattern.sub(), and
|
|
|
|
|
pattern.subn() methods have been rewritten in C. Also, an
|
|
|
|
|
experimental function/method finditer() has been added, which works
|
|
|
|
|
like findall() but returns an iterator.
|
2001-11-03 15:35:43 -04:00
|
|
|
|
|
2001-11-02 19:48:20 -04:00
|
|
|
|
- Tix exposes more commands through the classes DirSelectBox,
|
|
|
|
|
DirSelectDialog, ListNoteBook, Meter, CheckList, and the
|
|
|
|
|
methods tix_addbitmapdir, tix_cget, tix_configure, tix_filedialog,
|
|
|
|
|
tix_getbitmap, tix_getimage, tix_option_get, and tix_resetoptions.
|
|
|
|
|
|
2001-10-22 22:59:54 -03:00
|
|
|
|
- Traceback objects are now scanned by cyclic garbage collection, so
|
|
|
|
|
cycles created by casual use of sys.exc_info() no longer cause
|
|
|
|
|
permanent memory leaks (provided garbage collection is enabled).
|
|
|
|
|
|
2001-10-24 17:51:44 -03:00
|
|
|
|
- os.extsep -- a new variable needed by the RISCOS support. It is the
|
|
|
|
|
separator used by extensions, and is '.' on all platforms except
|
|
|
|
|
RISCOS, where it is '/'. There is no need to use this variable
|
|
|
|
|
unless you have a masochistic desire to port your code to RISCOS.
|
|
|
|
|
|
2001-11-16 12:17:27 -04:00
|
|
|
|
- mimetypes.py has optional support for non-standard, but commonly
|
|
|
|
|
found types. guess_type() and guess_extension() now accept an
|
|
|
|
|
optional `strict' flag, defaulting to true, which controls whether
|
|
|
|
|
recognize non-standard types or not. A few non-standard types we
|
|
|
|
|
know about have been added. Also, when run as a script, there are
|
|
|
|
|
new -l and -e options.
|
|
|
|
|
|
|
|
|
|
- statcache is now deprecated.
|
|
|
|
|
|
|
|
|
|
- email.Utils.formatdate() now produces the preferred RFC 2822 style
|
|
|
|
|
dates with numeric timezones (it used to produce obsolete dates
|
|
|
|
|
hard coded to "GMT" timezone). An optional `localtime' flag is
|
|
|
|
|
added to produce dates in the local timezone, with daylight savings
|
|
|
|
|
time properly taken into account.
|
|
|
|
|
|
|
|
|
|
- In pickle and cPickle, instead of masking errors in load() by
|
|
|
|
|
transforming them into SystemError, we let the original exception
|
|
|
|
|
propagate out. Also, implement support for __safe_for_unpickling__
|
|
|
|
|
in pickle, as it already was supported in cPickle.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Tools/Demos
|
|
|
|
|
|
|
|
|
|
Build
|
|
|
|
|
|
2001-11-16 12:17:27 -04:00
|
|
|
|
- The dbm module is built using libdb1 if available. The bsddb module
|
|
|
|
|
is built with libdb3 if available.
|
|
|
|
|
|
|
|
|
|
- Misc/Makefile.pre.in has been removed by BDFL pronouncement.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
C API
|
|
|
|
|
|
Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).
dictobject.c, new functions PyDict_{Merge,Update}FromSeq2. These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object. For now, I left these
functions file static, so no corresponding doc changes. It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.
Also changed the name of dictionary's keyword argument from "mapping"
to "x". Got a better name? "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.
abstract.h, abstract.tex: Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.
libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
iteration, or an iterator object" is getting to be a PITA. Many
months ago I suggested factoring this out into "iterable object",
where the definition of that could include being explicit about
generators too (as is, I'm not sure a reader outside of PythonLabs
could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.
abstract.c, PySequence_Tuple(): When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
2001-10-26 02:06:50 -03:00
|
|
|
|
- New function PySequence_Fast_GET_SIZE() returns the size of a non-
|
|
|
|
|
NULL result from PySequence_Fast(), more quickly than calling
|
|
|
|
|
PySequence_Size().
|
|
|
|
|
|
2001-11-16 12:17:27 -04:00
|
|
|
|
- New argument unpacking function PyArg_UnpackTuple() added.
|
|
|
|
|
|
|
|
|
|
- New functions PyObject_CallFunctionObjArgs() and
|
|
|
|
|
PyObject_CallMethodObjArgs() have been added to make it more
|
|
|
|
|
convenient and efficient to call functions and methods from C.
|
|
|
|
|
|
|
|
|
|
- PyArg_ParseTupleAndKeywords() no longer masks errors, so it's
|
|
|
|
|
possible that this will propagate errors it didn't before.
|
|
|
|
|
|
|
|
|
|
- New function PyObject_CheckReadBuffer(), which returns true if its
|
|
|
|
|
argument supports the single-segment readable buffer interface.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
New platforms
|
|
|
|
|
|
2001-10-27 19:28:54 -03:00
|
|
|
|
- We've finally confirmed that this release builds on HP-UX 11.00,
|
|
|
|
|
*with* threads, and passes the test suite.
|
|
|
|
|
|
2001-11-04 22:51:07 -04:00
|
|
|
|
- Thanks to a series of patches from Michael Muller, Python may build
|
|
|
|
|
again under OS/2 Visual Age C++.
|
|
|
|
|
|
2001-10-24 17:51:44 -03:00
|
|
|
|
- Updated RISCOS port by Dietmar Schwertberger.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Tests
|
|
|
|
|
|
2001-10-22 13:37:10 -03:00
|
|
|
|
- Added a test script for the curses module. It isn't run automatically;
|
|
|
|
|
regrtest.py must be run with '-u curses' to enable it.
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
Windows
|
|
|
|
|
|
2001-11-16 12:17:27 -04:00
|
|
|
|
Mac
|
|
|
|
|
|
|
|
|
|
- PythonScript has been moved to unsupported and is slated to be
|
|
|
|
|
removed completely in the next release.
|
|
|
|
|
|
|
|
|
|
- It should now be possible to build applets that work on both OS9 and
|
|
|
|
|
OSX.
|
|
|
|
|
|
|
|
|
|
- The core is now linked with CoreServices not Carbon; as a side
|
|
|
|
|
result, default 8bit encoding on OSX is now ASCII.
|
|
|
|
|
|
|
|
|
|
- Python should now build on OSX 10.1.1
|
|
|
|
|
|
2001-10-19 14:55:30 -03:00
|
|
|
|
|
2001-09-28 18:53:42 -03:00
|
|
|
|
What's New in Python 2.2b1?
|
2001-10-18 23:05:35 -03:00
|
|
|
|
Release date: 19-Oct-2001
|
2001-09-28 18:53:42 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
2001-10-15 19:03:32 -03:00
|
|
|
|
- New-style classes are now always dynamic (except for built-in and
|
2001-10-15 21:46:57 -03:00
|
|
|
|
extension types). There is no longer a performance penalty, and I
|
2001-10-15 19:03:32 -03:00
|
|
|
|
no longer see another reason to keep this baggage around. One relic
|
2001-10-15 21:46:57 -03:00
|
|
|
|
remains: the __dict__ of a new-style class is a read-only proxy; you
|
|
|
|
|
must set the class's attribute to modify it. As a consequence, the
|
2001-10-15 19:03:32 -03:00
|
|
|
|
__defined__ attribute of new-style types no longer exists, for lack
|
|
|
|
|
of need: there is once again only one __dict__ (although in the
|
2001-10-15 21:46:57 -03:00
|
|
|
|
future a __cache__ may be resurrected with a similar function, if I
|
|
|
|
|
can prove that it actually speeds things up).
|
2001-10-04 16:46:06 -03:00
|
|
|
|
|
2001-10-04 03:43:12 -03:00
|
|
|
|
- C.__doc__ now works as expected for new-style classes (in 2.2a4 it
|
|
|
|
|
always returned None, even when there was a class docstring).
|
|
|
|
|
|
|
|
|
|
- doctest now finds and runs docstrings attached to new-style classes,
|
|
|
|
|
class methods, static methods, and properties.
|
|
|
|
|
|
2001-10-16 18:34:49 -03:00
|
|
|
|
Core and builtins
|
2001-09-28 18:53:42 -03:00
|
|
|
|
|
2001-10-15 12:53:58 -03:00
|
|
|
|
- A very subtle syntactical pitfall in list comprehensions was fixed.
|
|
|
|
|
For example: [a+b for a in 'abc', for b in 'def']. The comma in
|
|
|
|
|
this example is a mistake. Previously, this would silently let 'a'
|
|
|
|
|
iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
|
|
|
|
|
'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
|
|
|
|
|
'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
|
|
|
|
|
Note that [a for a in <singleton>] is a convoluted way to say
|
|
|
|
|
[<singleton>] anyway, so it's not like any expressiveness is lost.
|
|
|
|
|
|
2001-10-16 18:34:49 -03:00
|
|
|
|
- getattr(obj, name, default) now only catches AttributeError, as
|
|
|
|
|
documented, rather than returning the default value for all
|
|
|
|
|
exceptions (which could mask bugs in a __getattr__ hook, for
|
|
|
|
|
example).
|
|
|
|
|
|
2001-10-22 15:41:51 -03:00
|
|
|
|
- Weak reference objects are now part of the core and offer a C API.
|
2001-10-18 15:18:06 -03:00
|
|
|
|
A bug which could allow a core dump when binary operations involved
|
2001-10-21 22:47:26 -03:00
|
|
|
|
proxy reference has been fixed. weakref.ReferenceError is now a
|
2001-10-19 02:35:40 -03:00
|
|
|
|
built-in exception.
|
2001-10-18 15:18:06 -03:00
|
|
|
|
|
2001-10-18 23:05:35 -03:00
|
|
|
|
- unicode(obj) now behaves more like str(obj), accepting arbitrary
|
|
|
|
|
objects, and calling a __unicode__ method if it exists.
|
|
|
|
|
unicode(obj, encoding) and unicode(obj, encoding, errors) still
|
2001-10-19 09:02:29 -03:00
|
|
|
|
require an 8-bit string or character buffer argument.
|
2001-10-18 23:05:35 -03:00
|
|
|
|
|
2001-10-19 02:35:40 -03:00
|
|
|
|
- isinstance() now allows any object as the first argument and a
|
|
|
|
|
class, a type or something with a __bases__ tuple attribute for the
|
|
|
|
|
second argument. The second argument may also be a tuple of a
|
|
|
|
|
class, type, or something with __bases__, in which case isinstance()
|
|
|
|
|
will return true if the first argument is an instance of any of the
|
|
|
|
|
things contained in the second argument tuple. E.g.
|
|
|
|
|
|
|
|
|
|
isinstance(x, (A, B))
|
|
|
|
|
|
|
|
|
|
returns true if x is an instance of A or B.
|
|
|
|
|
|
2001-10-16 18:34:49 -03:00
|
|
|
|
Extension modules
|
|
|
|
|
|
|
|
|
|
- thread.start_new_thread() now returns the thread ID (previously None).
|
|
|
|
|
|
2001-09-30 17:32:11 -03:00
|
|
|
|
- binascii has now two quopri support functions, a2b_qp and b2a_qp.
|
|
|
|
|
|
2001-10-18 22:31:59 -03:00
|
|
|
|
- readline now supports setting the startup_hook and the
|
|
|
|
|
pre_event_hook, and adds the add_history() function.
|
|
|
|
|
|
|
|
|
|
- os and posix supports chroot(), setgroups() and unsetenv() where
|
|
|
|
|
available. The stat(), fstat(), statvfs() and fstatvfs() functions
|
|
|
|
|
now return "pseudo-sequences" -- the various fields can now be
|
|
|
|
|
accessed as attributes (e.g. os.stat("/").st_mtime) but for
|
|
|
|
|
backwards compatibility they also behave as a fixed-length sequence.
|
|
|
|
|
Some platform-specific fields (e.g. st_rdev) are only accessible as
|
SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files. Some of the platforms
aren't tested yet. Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences. When accessed as a sequence, they behave exactly as
before. But they also have attributes like st_mtime or tm_year. The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there). If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.
(Still missing is a documentation update.)
2001-10-18 17:34:25 -03:00
|
|
|
|
attributes.
|
|
|
|
|
|
|
|
|
|
- time: localtime(), gmtime() and strptime() now return a
|
|
|
|
|
pseudo-sequence similar to the os.stat() return value, with
|
|
|
|
|
attributes like tm_year etc.
|
2001-10-04 19:46:41 -03:00
|
|
|
|
|
2001-10-16 18:34:49 -03:00
|
|
|
|
- Decompression objects in the zlib module now accept an optional
|
|
|
|
|
second parameter to decompress() that specifies the maximum amount
|
|
|
|
|
of memory to use for the uncompressed data.
|
2001-09-28 18:53:42 -03:00
|
|
|
|
|
2001-10-19 00:40:19 -03:00
|
|
|
|
- optional SSL support in the socket module now exports OpenSSL
|
|
|
|
|
functions RAND_add(), RAND_egd(), and RAND_status(). These calls
|
|
|
|
|
are useful on platforms like Solaris where OpenSSL does not
|
2001-10-19 02:35:40 -03:00
|
|
|
|
automatically seed its PRNG. Also, the keyfile and certfile
|
|
|
|
|
arguments to socket.ssl() are now optional.
|
|
|
|
|
|
|
|
|
|
- posixmodule (and by extension, the os module on POSIX platforms) now
|
|
|
|
|
exports O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW.
|
2001-10-19 00:40:19 -03:00
|
|
|
|
|
2001-10-16 18:34:49 -03:00
|
|
|
|
Library
|
2001-10-16 18:13:49 -03:00
|
|
|
|
|
2001-10-02 00:53:41 -03:00
|
|
|
|
- doctest now excludes functions and classes not defined by the module
|
|
|
|
|
being tested, thanks to Tim Hochberg.
|
|
|
|
|
|
2001-10-22 15:41:51 -03:00
|
|
|
|
- HotShot, a new profiler implemented using a C-based callback, has
|
|
|
|
|
been added. This substantially reduces the overhead of profiling,
|
|
|
|
|
but it is still quite preliminary. Support modules and
|
|
|
|
|
documentation will be added in upcoming releases (before 2.2 final).
|
|
|
|
|
|
2001-10-04 07:19:00 -03:00
|
|
|
|
- profile now produces correct output in situations where an exception
|
|
|
|
|
raised in Python is cleared by C code (e.g. hasattr()). This used
|
|
|
|
|
to cause wrong output, including spurious claims of recursive
|
|
|
|
|
functions and attribution of time spent to the wrong function.
|
|
|
|
|
|
2001-10-07 00:12:08 -03:00
|
|
|
|
The code and documentation for the derived OldProfile and HotProfile
|
|
|
|
|
profiling classes was removed. The code hasn't worked for years (if
|
|
|
|
|
you tried to use them, they raised exceptions). OldProfile
|
|
|
|
|
intended to reproduce the behavior of the profiler Python used more
|
|
|
|
|
than 7 years ago, and isn't interesting anymore. HotProfile intended
|
|
|
|
|
to provide a faster profiler (but producing less information), and
|
|
|
|
|
that's a worthy goal we intend to meet via a different approach (but
|
|
|
|
|
without losing information).
|
|
|
|
|
|
2001-10-09 02:31:56 -03:00
|
|
|
|
- Profile.calibrate() has a new implementation that should deliver
|
2001-10-09 17:51:19 -03:00
|
|
|
|
a much better system-specific calibration constant. The constant can
|
|
|
|
|
now be specified in an instance constructor, or as a Profile class or
|
|
|
|
|
instance variable, instead of by editing profile.py's source code.
|
|
|
|
|
Calibration must still be done manually (see the docs for the profile
|
|
|
|
|
module).
|
|
|
|
|
|
|
|
|
|
Note that Profile.calibrate() must be overriden by subclasses.
|
|
|
|
|
Improving the accuracy required exploiting detailed knowledge of
|
|
|
|
|
profiler internals; the earlier method abstracted away the details
|
|
|
|
|
and measured a simplified model instead, but consequently computed
|
|
|
|
|
a constant too small by a factor of 2 on some modern machines.
|
2001-10-09 02:31:56 -03:00
|
|
|
|
|
2001-09-30 17:32:11 -03:00
|
|
|
|
- quopri's encode and decode methods take an optional header parameter,
|
2001-10-16 17:42:52 -03:00
|
|
|
|
which indicates whether output is intended for the header 'Q'
|
|
|
|
|
encoding.
|
|
|
|
|
|
2001-10-18 15:02:07 -03:00
|
|
|
|
- The SocketServer.ThreadingMixIn class now closes the request after
|
|
|
|
|
finish_request() returns. (Not when it errors out though.)
|
|
|
|
|
|
2001-10-19 02:35:40 -03:00
|
|
|
|
- The nntplib module's NNTP.body() method has grown a `file' argument
|
|
|
|
|
to allow saving the message body to a file.
|
|
|
|
|
|
|
|
|
|
- The email package has added a class email.Parser.HeaderParser which
|
|
|
|
|
only parses headers and does not recurse into the message's body.
|
|
|
|
|
Also, the module/class MIMEAudio has been added for representing
|
|
|
|
|
audio data (contributed by Anthony Baxter).
|
|
|
|
|
|
|
|
|
|
- ftplib should be able to handle files > 2GB.
|
|
|
|
|
|
|
|
|
|
- ConfigParser.getboolean() now also interprets TRUE, FALSE, YES, NO,
|
|
|
|
|
ON, and OFF.
|
|
|
|
|
|
2001-10-22 15:41:51 -03:00
|
|
|
|
- xml.dom.minidom NodeList objects now support the length attribute
|
|
|
|
|
and item() method as required by the DOM specifications.
|
|
|
|
|
|
2001-10-02 20:15:37 -03:00
|
|
|
|
Tools/Demos
|
|
|
|
|
|
|
|
|
|
- Demo/dns was removed. It no longer serves any purpose; a package
|
|
|
|
|
derived from it is now maintained by Anthony Baxter, see
|
|
|
|
|
http://PyDNS.SourceForge.net.
|
2001-09-28 18:53:42 -03:00
|
|
|
|
|
2001-10-19 02:35:40 -03:00
|
|
|
|
- The freeze tool has been made more robust, and two new options have
|
|
|
|
|
been added: -X and -E.
|
|
|
|
|
|
2001-09-28 18:53:42 -03:00
|
|
|
|
Build
|
|
|
|
|
|
2001-10-19 02:35:40 -03:00
|
|
|
|
- configure will use CXX in LINKCC if CXX is used to build main() and
|
|
|
|
|
the system requires to link a C++ main using the C++ compiler.
|
|
|
|
|
|
2001-09-28 18:53:42 -03:00
|
|
|
|
C API
|
|
|
|
|
|
2001-10-18 16:20:25 -03:00
|
|
|
|
- The documentation for the tp_compare slot is updated to require that
|
|
|
|
|
the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
|
|
|
|
|
not correct. This is not yet enforced but will be enforced in
|
|
|
|
|
Python 2.3; even later, we may use -2 to indicate errors and +2 for
|
|
|
|
|
"NotImplemented". Right now, -1 should be used for an error return.
|
|
|
|
|
|
2001-09-30 02:09:37 -03:00
|
|
|
|
- PyLong_AsLongLong() now accepts int (as well as long) arguments.
|
|
|
|
|
Consequently, PyArg_ParseTuple's 'L' code also accepts int (as well
|
|
|
|
|
as long) arguments.
|
|
|
|
|
|
2001-10-16 18:13:49 -03:00
|
|
|
|
- PyThread_start_new_thread() now returns a long int giving the thread
|
|
|
|
|
ID, if one can be calculated; it returns -1 for error, 0 if no
|
|
|
|
|
thread ID is calculated (this is an incompatible change, but only
|
|
|
|
|
the thread module used this API). This code has only really been
|
|
|
|
|
tested on Linux and Windows; other platforms please beware (and
|
|
|
|
|
report any bugs or strange behavior).
|
|
|
|
|
|
2001-10-18 23:05:35 -03:00
|
|
|
|
- PyUnicode_FromEncodedObject() no longer accepts Unicode objects as
|
|
|
|
|
input.
|
|
|
|
|
|
2001-09-28 18:53:42 -03:00
|
|
|
|
New platforms
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
Windows
|
|
|
|
|
|
2001-10-09 19:39:40 -03:00
|
|
|
|
- Installer: If you install IDLE, and don't disable file-extension
|
|
|
|
|
registration, a new "Edit with IDLE" context (right-click) menu entry
|
|
|
|
|
is created for .py and .pyw files.
|
|
|
|
|
|
2001-10-01 14:58:40 -03:00
|
|
|
|
- The signal module now supports SIGBREAK on Windows, thanks to Steven
|
|
|
|
|
Scott. Note that SIGBREAK is unique to Windows. The default SIGBREAK
|
|
|
|
|
action remains to call Win32 ExitProcess(). This can be changed via
|
|
|
|
|
signal.signal(). For example:
|
|
|
|
|
|
|
|
|
|
# Make Ctrl+Break raise KeyboardInterrupt, like Python's default Ctrl+C
|
|
|
|
|
# (SIGINT) behavior.
|
|
|
|
|
import signal
|
|
|
|
|
signal.signal(signal.SIGBREAK,
|
|
|
|
|
signal.default_int_handler)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
while 1:
|
|
|
|
|
pass
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
|
# We get here on Ctrl+C or Ctrl+Break now; if we had not changed
|
|
|
|
|
# SIGBREAK, only on Ctrl+C (and Ctrl+Break would terminate the
|
|
|
|
|
# program without the possibility for any Python-level cleanup).
|
|
|
|
|
print "Clean exit"
|
|
|
|
|
|
2001-09-28 18:53:42 -03:00
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
What's New in Python 2.2a4?
|
2001-09-28 12:26:12 -03:00
|
|
|
|
Release date: 28-Sep-2001
|
2001-09-07 22:25:47 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
2001-09-25 01:15:41 -03:00
|
|
|
|
Type/class unification and new-style classes
|
|
|
|
|
|
|
|
|
|
- pydoc and inspect are now aware of new-style classes;
|
|
|
|
|
e.g. help(list) at the interactive prompt now shows proper
|
|
|
|
|
documentation for all operations on list objects.
|
|
|
|
|
|
|
|
|
|
- Applications using Jim Fulton's ExtensionClass module can now safely
|
|
|
|
|
be used with Python 2.2. In particular, Zope 2.4.1 now works with
|
|
|
|
|
Python 2.2 (as well as with Python 2.1.1). The Demo/metaclass
|
|
|
|
|
examples also work again. It is hoped that Gtk and Boost also work
|
|
|
|
|
with 2.2a4 and beyond. (If you can confirm this, please write
|
|
|
|
|
webmaster@python.org; if there are still problems, please open a bug
|
|
|
|
|
report on SourceForge.)
|
2001-09-07 22:25:47 -03:00
|
|
|
|
|
2001-09-24 18:17:50 -03:00
|
|
|
|
- property() now takes 4 keyword arguments: fget, fset, fdel and doc.
|
2002-05-07 17:58:03 -03:00
|
|
|
|
These map to read-only attributes 'fget', 'fset', 'fdel', and '__doc__'
|
2001-09-24 18:17:50 -03:00
|
|
|
|
in the constructed property object. fget, fset and fdel weren't
|
|
|
|
|
discoverable from Python in 2.2a3. __doc__ is new, and allows to
|
|
|
|
|
associate a docstring with a property.
|
|
|
|
|
|
2001-09-25 01:15:41 -03:00
|
|
|
|
- Comparison overloading is now more completely implemented. For
|
|
|
|
|
example, a str subclass instance can properly be compared to a str
|
|
|
|
|
instance, and it can properly overload comparison. Ditto for most
|
|
|
|
|
other built-in object types.
|
|
|
|
|
|
|
|
|
|
- The repr() of new-style classes has changed; instead of <type
|
|
|
|
|
'M.Foo'> a new-style class is now rendered as <class 'M.Foo'>,
|
|
|
|
|
*except* for built-in types, which are still rendered as <type
|
|
|
|
|
'Foo'> (to avoid upsetting existing code that might parse or
|
|
|
|
|
otherwise rely on repr() of certain type objects).
|
|
|
|
|
|
|
|
|
|
- The repr() of new-style objects is now always <Foo object at XXX>;
|
|
|
|
|
previously, it was sometimes <Foo instance at XXX>.
|
|
|
|
|
|
|
|
|
|
- For new-style classes, what was previously called __getattr__ is now
|
|
|
|
|
called __getattribute__. This method, if defined, is called for
|
2001-10-21 22:47:26 -03:00
|
|
|
|
*every* attribute access. A new __getattr__ hook more similar to the
|
2001-09-25 01:15:41 -03:00
|
|
|
|
one in classic classes is defined which is called only if regular
|
|
|
|
|
attribute access raises AttributeError; to catch *all* attribute
|
|
|
|
|
access, you can use __getattribute__ (for new-style classes). If
|
|
|
|
|
both are defined, __getattribute__ is called first, and if it raises
|
|
|
|
|
AttributeError, __getattr__ is called.
|
|
|
|
|
|
|
|
|
|
- The __class__ attribute of new-style objects can be assigned to.
|
|
|
|
|
The new class must have the same C-level object layout as the old
|
|
|
|
|
class.
|
|
|
|
|
|
|
|
|
|
- The builtin file type can be subclassed now. In the usual pattern,
|
|
|
|
|
"file" is the name of the builtin type, and file() is a new builtin
|
|
|
|
|
constructor, with the same signature as the builtin open() function.
|
|
|
|
|
file() is now the preferred way to open a file.
|
|
|
|
|
|
|
|
|
|
- Previously, __new__ would only see sequential arguments passed to
|
|
|
|
|
the type in a constructor call; __init__ would see both sequential
|
|
|
|
|
and keyword arguments. This made no sense whatsoever any more, so
|
|
|
|
|
now both __new__ and __init__ see all arguments.
|
|
|
|
|
|
|
|
|
|
- Previously, hash() applied to an instance of a subclass of str or
|
|
|
|
|
unicode always returned 0. This has been repaired.
|
|
|
|
|
|
|
|
|
|
- Previously, an operation on an instance of a subclass of an
|
|
|
|
|
immutable type (int, long, float, complex, tuple, str, unicode),
|
|
|
|
|
where the subtype didn't override the operation (and so the
|
|
|
|
|
operation was handled by the builtin type), could return that
|
|
|
|
|
instance instead a value of the base type. For example, if s was of
|
2002-05-07 17:58:03 -03:00
|
|
|
|
a str subclass type, s[:] returned s as-is. Now it returns a str
|
2001-09-25 01:15:41 -03:00
|
|
|
|
with the same value as s.
|
|
|
|
|
|
2001-09-28 12:26:12 -03:00
|
|
|
|
- Provisional support for pickling new-style objects has been added.
|
|
|
|
|
|
2001-09-25 01:15:41 -03:00
|
|
|
|
Core
|
|
|
|
|
|
2001-09-23 01:06:05 -03:00
|
|
|
|
- file.writelines() now accepts any iterable object producing strings.
|
|
|
|
|
|
2001-09-20 09:59:37 -03:00
|
|
|
|
- PyUnicode_FromEncodedObject() now works very much like
|
|
|
|
|
PyObject_Str(obj) in that it tries to use __str__/tp_str
|
|
|
|
|
on the object if the object is not a string or buffer. This
|
|
|
|
|
makes unicode() behave like str() when applied to non-string/buffer
|
|
|
|
|
objects.
|
|
|
|
|
|
2001-10-21 22:47:26 -03:00
|
|
|
|
- PyFile_WriteObject now passes Unicode objects to the file's write
|
|
|
|
|
method. As a result, all file-like objects which may be the target
|
2001-09-19 10:47:32 -03:00
|
|
|
|
of a print statement must support Unicode objects, i.e. they must
|
|
|
|
|
at least convert them into ASCII strings.
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- Thread scheduling on Solaris should be improved; it is no longer
|
|
|
|
|
necessary to insert a small sleep at the start of a thread in order
|
|
|
|
|
to let other runnable threads be scheduled.
|
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
Library
|
|
|
|
|
|
2001-09-27 11:17:33 -03:00
|
|
|
|
- StringIO.StringIO instances and cStringIO.StringIO instances support
|
|
|
|
|
read character buffer compatible objects for their .write() methods.
|
|
|
|
|
These objects are converted to strings and then handled as such
|
|
|
|
|
by the instances.
|
|
|
|
|
|
2001-09-24 01:28:10 -03:00
|
|
|
|
- The "email" package has been added. This is basically a port of the
|
|
|
|
|
mimelib package <http://sf.net/projects/mimelib> with API changes
|
|
|
|
|
and some implementations updated to use iterators and generators.
|
|
|
|
|
|
2001-09-22 18:30:22 -03:00
|
|
|
|
- difflib.ndiff() and difflib.Differ.compare() are generators now. This
|
|
|
|
|
restores the ability of Tools/scripts/ndiff.py to start producing output
|
|
|
|
|
before the entire comparison is complete.
|
|
|
|
|
|
2001-09-22 01:44:21 -03:00
|
|
|
|
- StringIO.StringIO instances and cStringIO.StringIO instances support
|
|
|
|
|
iteration just like file objects (i.e. their .readline() method is
|
|
|
|
|
called for each iteration until it returns an empty string).
|
|
|
|
|
|
2001-09-19 08:33:31 -03:00
|
|
|
|
- The codecs module has grown four new helper APIs to access
|
|
|
|
|
builtin codecs: getencoder(), getdecoder(), getreader(),
|
|
|
|
|
getwriter().
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- SimpleXMLRPCServer: a new module (based upon SimpleHTMLServer)
|
|
|
|
|
simplifies writing XML RPC servers.
|
|
|
|
|
|
2001-09-28 14:01:02 -03:00
|
|
|
|
- os.path.realpath(): a new function that returns the absolute pathname
|
2001-09-18 12:21:04 -03:00
|
|
|
|
after interpretation of symbolic links. On non-Unix systems, this
|
|
|
|
|
is an alias for os.path.abspath().
|
|
|
|
|
|
2001-09-08 01:00:12 -03:00
|
|
|
|
- operator.indexOf() (PySequence_Index() in the C API) now works with any
|
|
|
|
|
iterable object.
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- smtplib now supports various authentication and security features of
|
|
|
|
|
the SMTP protocol through the new login() and starttls() methods.
|
|
|
|
|
|
|
|
|
|
- hmac: a new module implementing keyed hashing for message
|
|
|
|
|
authentication.
|
2001-09-14 13:35:16 -03:00
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- mimetypes now recognizes more extensions and file types. At the
|
|
|
|
|
same time, some mappings not sanctioned by IANA were removed.
|
2001-09-14 13:35:16 -03:00
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- The "compiler" package has been brought up to date to the state of
|
2001-09-20 02:30:24 -03:00
|
|
|
|
Python 2.2 bytecode generation. It has also been promoted from a
|
|
|
|
|
Tool to a standard library package. (Tools/compiler still exists as
|
|
|
|
|
a sample driver.)
|
|
|
|
|
|
|
|
|
|
Tools
|
2001-09-18 12:21:04 -03:00
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
Build
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- Large file support (LFS) is now automatic when the platform supports
|
|
|
|
|
it; no more manual configuration tweaks are needed. On Linux, at
|
|
|
|
|
least, it's possible to have a system whose C library supports large
|
|
|
|
|
files but whose kernel doesn't; in this case, large file support is
|
|
|
|
|
still enabled but doesn't do you any good unless you upgrade your
|
|
|
|
|
kernel or share your Python executable with another system whose
|
|
|
|
|
kernel has large file support.
|
|
|
|
|
|
|
|
|
|
- The configure script now supplies plausible defaults in a
|
|
|
|
|
cross-compilation environment. This doesn't mean that the supplied
|
|
|
|
|
values are always correct, or that cross-compilation now works
|
|
|
|
|
flawlessly -- but it's a first step (and it shuts up most of
|
|
|
|
|
autoconf's warnings about AC_TRY_RUN).
|
|
|
|
|
|
|
|
|
|
- The Unix build is now a bit less chatty, courtesy of the parser
|
|
|
|
|
generator. The build is completely silent (except for errors) when
|
|
|
|
|
using "make -s", thanks to a -q option to setup.py.
|
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
C API
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- The "structmember" API now supports some new flag bits to deny read
|
|
|
|
|
and/or write access to attributes in restricted execution mode.
|
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
New platforms
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- Compaq's iPAQ handheld, running the "familiar" Linux distribution
|
|
|
|
|
(http://familiar.handhelds.org).
|
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
Tests
|
|
|
|
|
|
2001-09-22 18:30:22 -03:00
|
|
|
|
- The "classic" standard tests, which work by comparing stdout to
|
|
|
|
|
an expected-output file under Lib/test/output/, no longer stop at
|
|
|
|
|
the first mismatch. Instead the test is run to completion, and a
|
|
|
|
|
variant of ndiff-style comparison is used to report all differences.
|
|
|
|
|
This is much easier to understand than the previous style of reporting.
|
|
|
|
|
|
|
|
|
|
- The unittest-based standard tests now use regrtest's test_main()
|
|
|
|
|
convention, instead of running as a side-effect of merely being
|
|
|
|
|
imported. This allows these tests to be run in more natural and
|
|
|
|
|
flexible ways as unittests, outside the regrtest framework.
|
|
|
|
|
|
|
|
|
|
- regrtest.py is much better integrated with unittest and doctest now,
|
|
|
|
|
especially in regard to reporting errors.
|
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
Windows
|
|
|
|
|
|
2001-09-18 12:21:04 -03:00
|
|
|
|
- Large file support now also works for files > 4GB, on filesystems
|
2001-09-22 18:30:22 -03:00
|
|
|
|
that support it (NTFS under Windows 2000). See "What's New in
|
|
|
|
|
Python 2.2a3" for more detail.
|
2001-09-18 12:21:04 -03:00
|
|
|
|
|
2001-09-07 22:25:47 -03:00
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
What's New in Python 2.2a3?
|
2001-09-28 12:26:12 -03:00
|
|
|
|
Release Date: 07-Sep-2001
|
2001-08-22 18:36:50 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Core
|
|
|
|
|
|
2001-09-04 02:14:19 -03:00
|
|
|
|
- Conversion of long to float now raises OverflowError if the long is too
|
|
|
|
|
big to represent as a C double.
|
|
|
|
|
|
2001-09-03 05:35:41 -03:00
|
|
|
|
- The 3-argument builtin pow() no longer allows a third non-None argument
|
|
|
|
|
if either of the first two arguments is a float, or if both are of
|
|
|
|
|
integer types and the second argument is negative (in which latter case
|
|
|
|
|
the arguments are converted to float, so this is really the same
|
|
|
|
|
restriction).
|
|
|
|
|
|
2001-09-03 02:47:38 -03:00
|
|
|
|
- The builtin dir() now returns more information, and sometimes much
|
|
|
|
|
more, generally naming all attributes of an object, and all attributes
|
|
|
|
|
reachable from the object via its class, and from its class's base
|
|
|
|
|
classes, and so on from them too. Example: in 2.2a2, dir([]) returned
|
|
|
|
|
an empty list. In 2.2a3,
|
|
|
|
|
|
|
|
|
|
>>> dir([])
|
|
|
|
|
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',
|
|
|
|
|
'__eq__', '__ge__', '__getattr__', '__getitem__', '__getslice__',
|
|
|
|
|
'__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__le__',
|
|
|
|
|
'__len__', '__lt__', '__mul__', '__ne__', '__new__', '__repr__',
|
|
|
|
|
'__rmul__', '__setattr__', '__setitem__', '__setslice__', '__str__',
|
|
|
|
|
'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
|
|
|
|
|
'reverse', 'sort']
|
|
|
|
|
|
|
|
|
|
dir(module) continues to return only the module's attributes, though.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- Overflowing operations on plain ints now return a long int rather
|
2001-08-31 15:31:35 -03:00
|
|
|
|
than raising OverflowError. This is a partial implementation of PEP
|
|
|
|
|
237. You can use -Wdefault::OverflowWarning to enable a warning for
|
|
|
|
|
this situation, and -Werror::OverflowWarning to revert to the old
|
|
|
|
|
OverflowError exception.
|
|
|
|
|
|
2001-09-04 00:26:15 -03:00
|
|
|
|
- A new command line option, -Q<arg>, is added to control run-time
|
2001-08-31 15:31:35 -03:00
|
|
|
|
warnings for the use of classic division. (See PEP 238.) Possible
|
2001-09-07 15:13:44 -03:00
|
|
|
|
values are -Qold, -Qwarn, -Qwarnall, and -Qnew. The default is
|
|
|
|
|
-Qold, meaning the / operator has its classic meaning and no
|
|
|
|
|
warnings are issued. Using -Qwarn issues a run-time warning about
|
|
|
|
|
all uses of classic division for int and long arguments; -Qwarnall
|
|
|
|
|
also warns about classic division for float and complex arguments
|
2001-12-06 02:23:26 -04:00
|
|
|
|
(for use with fixdiv.py).
|
|
|
|
|
[Note: the remainder of this paragraph (preserved below) became
|
|
|
|
|
obsolete in 2.2c1 -- -Qnew has global effect in 2.2]
|
|
|
|
|
<obsolete>
|
|
|
|
|
Using -Qnew is questionable; it turns on new division by default, but
|
|
|
|
|
only in the __main__ module. You can usefully combine -Qwarn or
|
|
|
|
|
-Qwarnall and -Qnew: this gives the __main__ module new division, and
|
|
|
|
|
warns about classic division everywhere else.
|
|
|
|
|
</obsolete>
|
2001-08-31 15:31:35 -03:00
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- Many built-in types can now be subclassed. This applies to int,
|
2001-08-31 15:31:35 -03:00
|
|
|
|
long, float, str, unicode, and tuple. (The types complex, list and
|
|
|
|
|
dictionary can also be subclassed; this was introduced earlier.)
|
|
|
|
|
Note that restrictions apply when subclassing immutable built-in
|
|
|
|
|
types: you can only affect the value of the instance by overloading
|
|
|
|
|
__new__. You can add mutable attributes, and the subclass instances
|
|
|
|
|
will have a __dict__ attribute, but you cannot change the "value"
|
|
|
|
|
(as implemented by the base class) of an immutable subclass instance
|
|
|
|
|
once it is created.
|
|
|
|
|
|
2001-09-02 10:44:35 -03:00
|
|
|
|
- The dictionary constructor now takes an optional argument, a
|
|
|
|
|
mapping-like object, and initializes the dictionary from its
|
|
|
|
|
(key, value) pairs.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- A new built-in type, super, has been added. This facilitates making
|
2001-08-31 15:31:35 -03:00
|
|
|
|
"cooperative super calls" in a multiple inheritance setting. For an
|
|
|
|
|
explanation, see http://www.python.org/2.2/descrintro.html#cooperation
|
|
|
|
|
|
2001-09-06 19:02:58 -03:00
|
|
|
|
- A new built-in type, property, has been added. This enables the
|
|
|
|
|
creation of "properties". These are attributes implemented by
|
|
|
|
|
getter and setter functions (or only one of these for read-only or
|
|
|
|
|
write-only attributes), without the need to override __getattr__.
|
|
|
|
|
See http://www.python.org/2.2/descrintro.html#property
|
2001-08-31 15:31:35 -03:00
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- The syntax of floating-point and imaginary literals has been
|
2001-08-30 17:51:59 -03:00
|
|
|
|
liberalized, to allow leading zeroes. Examples of literals now
|
|
|
|
|
legal that were SyntaxErrors before:
|
|
|
|
|
|
|
|
|
|
00.0 0e3 0100j 07.5 00000000000000000008.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- An old tokenizer bug allowed floating point literals with an incomplete
|
2001-08-28 17:56:27 -03:00
|
|
|
|
exponent, such as 1e and 3.1e-. Such literals now raise SyntaxError.
|
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
Library
|
|
|
|
|
|
2001-09-06 05:54:16 -03:00
|
|
|
|
- telnetlib includes symbolic names for the options, and support for
|
|
|
|
|
setting an option negotiation callback.
|
|
|
|
|
|
2001-09-05 19:36:56 -03:00
|
|
|
|
- The new C standard no longer requires that math libraries set errno to
|
|
|
|
|
ERANGE on overflow. For platform libraries that exploit this new
|
|
|
|
|
freedom, Python's overflow-checking was wholly broken. A new overflow-
|
|
|
|
|
checking scheme attempts to repair that, but may not be reliable on all
|
|
|
|
|
platforms (C doesn't seem to provide anything both useful and portable
|
|
|
|
|
in this area anymore).
|
|
|
|
|
|
2001-09-05 10:44:54 -03:00
|
|
|
|
- Asynchronous timeout actions are available through the new class
|
|
|
|
|
threading.Timer.
|
|
|
|
|
|
2001-09-04 21:53:45 -03:00
|
|
|
|
- math.log and math.log10 now return sensible results for even huge
|
|
|
|
|
long arguments. For example, math.log10(10 ** 10000) ~= 10000.0.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- A new function, imp.lock_held(), returns 1 when the import lock is
|
2001-08-30 02:16:13 -03:00
|
|
|
|
currently held. See the docs for the imp module.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- pickle, cPickle and marshal on 32-bit platforms can now correctly read
|
2001-08-28 23:28:42 -03:00
|
|
|
|
dumps containing ints written on platforms where Python ints are 8 bytes.
|
|
|
|
|
When read on a box where Python ints are 4 bytes, such values are
|
|
|
|
|
converted to Python longs.
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- In restricted execution mode (using the rexec module), unmarshalling
|
2001-08-31 15:31:35 -03:00
|
|
|
|
code objects is no longer allowed. This plugs a security hole.
|
|
|
|
|
|
2001-09-06 13:05:17 -03:00
|
|
|
|
- unittest.TestResult instances no longer store references to tracebacks
|
|
|
|
|
generated by test failures. This prevents unexpected dangling references
|
|
|
|
|
to objects that should be garbage collected between tests.
|
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
Tools
|
|
|
|
|
|
2001-09-07 15:13:44 -03:00
|
|
|
|
- Tools/scripts/fixdiv.py has been added which can be used to fix
|
|
|
|
|
division operators as per PEP 238.
|
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
Build
|
|
|
|
|
|
2001-09-07 15:13:44 -03:00
|
|
|
|
- If you are an adventurous person using Mac OS X you may want to look at
|
|
|
|
|
Mac/OSX. There is a Makefile there that will build Python as a real Mac
|
|
|
|
|
application, which can be used for experimenting with Carbon or Cocoa.
|
|
|
|
|
Discussion of this on pythonmac-sig, please.
|
|
|
|
|
|
2001-09-04 19:08:56 -03:00
|
|
|
|
C API
|
|
|
|
|
|
|
|
|
|
- New function PyObject_Dir(obj), like Python __builtin__.dir(obj).
|
2001-08-30 02:16:13 -03:00
|
|
|
|
|
2001-09-04 02:14:19 -03:00
|
|
|
|
- Note that PyLong_AsDouble can fail! This has always been true, but no
|
|
|
|
|
callers checked for it. It's more likely to fail now, because overflow
|
|
|
|
|
errors are properly detected now. The proper way to check:
|
|
|
|
|
|
|
|
|
|
double x = PyLong_AsDouble(some_long_object);
|
|
|
|
|
if (x == -1.0 && PyErr_Occurred()) {
|
|
|
|
|
/* The conversion failed. */
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- The GC API has been changed. Extensions that use the old API will still
|
2001-08-30 12:38:01 -03:00
|
|
|
|
compile but will not participate in GC. To upgrade an extension
|
|
|
|
|
module:
|
|
|
|
|
|
|
|
|
|
- rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC
|
2001-08-30 17:51:59 -03:00
|
|
|
|
|
2001-08-30 12:38:01 -03:00
|
|
|
|
- use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and
|
|
|
|
|
PyObject_GC_Del to deallocate them
|
2001-08-30 17:51:59 -03:00
|
|
|
|
|
2001-08-30 12:38:01 -03:00
|
|
|
|
- rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini
|
|
|
|
|
to PyObject_GC_UnTrack
|
2001-08-30 17:51:59 -03:00
|
|
|
|
|
2001-08-30 12:38:01 -03:00
|
|
|
|
- remove PyGC_HEAD_SIZE from object size calculations
|
|
|
|
|
|
|
|
|
|
- remove calls to PyObject_AS_GC and PyObject_FROM_GC
|
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- Two new functions: PyString_FromFormat() and PyString_FromFormatV().
|
2001-08-31 15:31:35 -03:00
|
|
|
|
These can be used safely to construct string objects from a
|
|
|
|
|
sprintf-style format string (similar to the format string supported
|
|
|
|
|
by PyErr_Format()).
|
2001-08-30 02:16:13 -03:00
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
New platforms
|
|
|
|
|
|
2001-09-02 20:01:43 -03:00
|
|
|
|
- Stephen Hansen contributed patches sufficient to get a clean compile
|
|
|
|
|
under Borland C (Windows), but he reports problems running it and ran
|
|
|
|
|
out of time to complete the port. Volunteers? Expect a MemoryError
|
|
|
|
|
when importing the types module; this is probably shallow, and
|
|
|
|
|
causing later failures too.
|
2001-09-02 00:40:59 -03:00
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
Windows
|
|
|
|
|
|
2001-09-05 21:32:15 -03:00
|
|
|
|
- Large file support is now enabled on Win32 platforms as well as on
|
|
|
|
|
Win64. This means that, for example, you can use f.tell() and f.seek()
|
|
|
|
|
to manipulate files larger than 2 gigabytes (provided you have enough
|
|
|
|
|
disk space, and are using a Windows filesystem that supports large
|
2001-09-11 20:18:51 -03:00
|
|
|
|
partitions). Windows filesystem limits: FAT has a 2GB (gigabyte)
|
|
|
|
|
filesize limit, and large file support makes no difference there.
|
|
|
|
|
FAT32's limit is 4GB, and files >= 2GB are easier to use from Python now.
|
|
|
|
|
NTFS has no practical limit on file size, and files of any size can be
|
|
|
|
|
used from Python now.
|
2001-09-05 21:32:15 -03:00
|
|
|
|
|
2001-09-02 00:40:59 -03:00
|
|
|
|
- The w9xpopen hack is now used on Windows NT and 2000 too when COMPSPEC
|
2001-08-27 03:37:48 -03:00
|
|
|
|
points to command.com (patch from Brian Quinlan).
|
|
|
|
|
|
2001-08-22 18:36:50 -03:00
|
|
|
|
|
2001-07-20 23:31:40 -03:00
|
|
|
|
What's New in Python 2.2a2?
|
2001-09-28 12:26:12 -03:00
|
|
|
|
Release Date: 22-Aug-2001
|
2001-07-20 23:31:40 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
2001-08-17 15:39:25 -03:00
|
|
|
|
Build
|
|
|
|
|
|
2001-08-22 17:26:56 -03:00
|
|
|
|
- Tim Peters developed a brand new Windows installer using Wise 8.1,
|
|
|
|
|
generously donated to us by Wise Solutions.
|
|
|
|
|
|
2001-08-17 15:39:25 -03:00
|
|
|
|
- configure supports a new option --enable-unicode, with the values
|
|
|
|
|
ucs2 and ucs4 (new in 2.2a1). With --disable-unicode, the Unicode
|
|
|
|
|
type and supporting code is completely removed from the interpreter.
|
2001-08-22 01:08:41 -03:00
|
|
|
|
|
2001-08-21 16:28:20 -03:00
|
|
|
|
- A new configure option --enable-framework builds a Mac OS X framework,
|
|
|
|
|
which "make frameworkinstall" will install. This provides a starting
|
|
|
|
|
point for more mac-like functionality, join pythonmac-sig@python.org
|
|
|
|
|
if you are interested in helping.
|
2001-08-17 15:39:25 -03:00
|
|
|
|
|
2001-08-22 01:08:41 -03:00
|
|
|
|
- The NeXT platform is no longer supported.
|
|
|
|
|
|
|
|
|
|
- The `new' module is now statically linked.
|
|
|
|
|
|
2001-08-15 03:06:44 -03:00
|
|
|
|
Tools
|
|
|
|
|
|
|
|
|
|
- The new Tools/scripts/cleanfuture.py can be used to automatically
|
2001-08-15 12:54:56 -03:00
|
|
|
|
edit out obsolete future statements from Python source code. See
|
2001-08-15 03:06:44 -03:00
|
|
|
|
the module docstring for details.
|
|
|
|
|
|
2001-07-20 23:31:40 -03:00
|
|
|
|
Tests
|
|
|
|
|
|
2001-08-12 19:25:01 -03:00
|
|
|
|
- regrtest.py now knows which tests are expected to be skipped on some
|
2001-08-22 01:08:41 -03:00
|
|
|
|
platforms, allowing to give clearer test result output. regrtest
|
|
|
|
|
also has optional --use/-u switch to run normally disabled tests
|
|
|
|
|
which require network access or consume significant disk resources.
|
2001-08-12 19:25:01 -03:00
|
|
|
|
|
2001-07-20 23:31:40 -03:00
|
|
|
|
- Several new tests in the standard test suite, with special thanks to
|
|
|
|
|
Nick Mathewson.
|
|
|
|
|
|
|
|
|
|
Core
|
|
|
|
|
|
2001-08-22 01:08:41 -03:00
|
|
|
|
- The floor division operator // has been added as outlined in PEP
|
|
|
|
|
238. The / operator still provides classic division (and will until
|
|
|
|
|
Python 3.0) unless "from __future__ import division" is included, in
|
|
|
|
|
which case the / operator will provide true division. The operator
|
|
|
|
|
module provides truediv() and floordiv() functions. Augmented
|
|
|
|
|
assignment variants are included, as are the equivalent overloadable
|
|
|
|
|
methods and C API methods. See the PEP for a full discussion:
|
|
|
|
|
<http://python.sf.net/peps/pep-0238.html>
|
|
|
|
|
|
2001-08-17 19:11:27 -03:00
|
|
|
|
- Future statements are now effective in simulated interactive shells
|
|
|
|
|
(like IDLE). This should "just work" by magic, but read Michael
|
|
|
|
|
Hudson's "Future statements in simulated shells" PEP 264 for full
|
|
|
|
|
details: <http://python.sf.net/peps/pep-0264.html>.
|
|
|
|
|
|
2001-08-17 18:21:04 -03:00
|
|
|
|
- The type/class unification (PEP 252-253) was integrated into the
|
|
|
|
|
trunk and is not so tentative any more (the exact specification of
|
|
|
|
|
some features is still tentative). A lot of work has done on fixing
|
|
|
|
|
bugs and adding robustness and features (performance still has to
|
|
|
|
|
come a long way).
|
|
|
|
|
|
2001-07-31 11:24:31 -03:00
|
|
|
|
- Warnings about a mismatch in the Python API during extension import
|
|
|
|
|
now use the Python warning framework (which makes it possible to
|
|
|
|
|
write filters for these warnings).
|
|
|
|
|
|
2001-08-14 15:35:02 -03:00
|
|
|
|
- A function's __dict__ (aka func_dict) will now always be a
|
|
|
|
|
dictionary. It used to be possible to delete it or set it to None,
|
|
|
|
|
but now both actions raise TypeErrors. It is still legal to set it
|
|
|
|
|
to a dictionary object. Getting func.__dict__ before any attributes
|
|
|
|
|
have been assigned now returns an empty dictionary instead of None.
|
|
|
|
|
|
2001-09-05 15:43:35 -03:00
|
|
|
|
- A new command line option, -E, was added which disables the use of
|
|
|
|
|
all environment variables, or at least those that are specifically
|
|
|
|
|
significant to Python. Usually those have a name starting with
|
|
|
|
|
"PYTHON". This was used to fix a problem where the tests fail if
|
|
|
|
|
the user happens to have PYTHONHOME or PYTHONPATH pointing to an
|
|
|
|
|
older distribution.
|
|
|
|
|
|
2001-07-31 11:42:42 -03:00
|
|
|
|
Library
|
|
|
|
|
|
2001-08-12 19:25:01 -03:00
|
|
|
|
- New class Differ and new functions ndiff() and restore() in difflib.py.
|
|
|
|
|
These package the algorithms used by the popular Tools/scripts/ndiff.py,
|
2001-08-15 03:06:44 -03:00
|
|
|
|
for programmatic reuse.
|
2001-08-12 19:25:01 -03:00
|
|
|
|
|
2001-07-31 11:42:42 -03:00
|
|
|
|
- New function xml.sax.saxutils.quoteattr(): Quote an XML attribute
|
|
|
|
|
value using the minimal quoting required for the value; more
|
|
|
|
|
reliable than using xml.sax.saxutils.escape() for attribute values.
|
|
|
|
|
|
|
|
|
|
- Readline completion support for cmd.Cmd was added.
|
|
|
|
|
|
2001-08-22 01:08:41 -03:00
|
|
|
|
- Calling os.tempnam() or os.tmpnam() generate RuntimeWarnings.
|
|
|
|
|
|
|
|
|
|
- Added function threading.BoundedSemaphore()
|
|
|
|
|
|
|
|
|
|
- Added Ka-Ping Yee's cgitb.py module.
|
|
|
|
|
|
|
|
|
|
- The `new' module now exposes the CO_xxx flags.
|
|
|
|
|
|
2001-11-24 05:24:51 -04:00
|
|
|
|
- The gc module offers the get_referents function.
|
|
|
|
|
|
2001-07-31 11:42:42 -03:00
|
|
|
|
New platforms
|
|
|
|
|
|
|
|
|
|
C API
|
|
|
|
|
|
2001-07-31 11:24:31 -03:00
|
|
|
|
- Two new APIs PyOS_snprintf() and PyOS_vsnprintf() were added
|
|
|
|
|
which provide a cross-platform implementations for the
|
|
|
|
|
relatively new snprintf()/vsnprintf() C lib APIs. In contrast to
|
|
|
|
|
the standard sprintf() and vsprintf() C lib APIs, these versions
|
|
|
|
|
apply bounds checking on the used buffer which enhances protection
|
|
|
|
|
against buffer overruns.
|
|
|
|
|
|
2001-07-31 11:37:40 -03:00
|
|
|
|
- Unicode APIs now use name mangling to assure that mixing interpreters
|
2001-08-04 05:12:36 -03:00
|
|
|
|
and extensions using different Unicode widths is rendered next to
|
|
|
|
|
impossible. Trying to import an incompatible Unicode-aware extension
|
2001-07-31 11:37:40 -03:00
|
|
|
|
will result in an ImportError. Unicode extensions writers must make
|
|
|
|
|
sure to check the Unicode width compatibility in their extensions by
|
|
|
|
|
using at least one of the mangled Unicode APIs in the extension.
|
|
|
|
|
|
2001-08-17 15:39:25 -03:00
|
|
|
|
- Two new flags METH_NOARGS and METH_O are available in method definition
|
|
|
|
|
tables to simplify implementation of methods with no arguments and a
|
|
|
|
|
single untyped argument. Calling such methods is more efficient than
|
|
|
|
|
calling corresponding METH_VARARGS methods. METH_OLDARGS is now
|
|
|
|
|
deprecated.
|
|
|
|
|
|
2001-08-04 05:12:36 -03:00
|
|
|
|
Windows
|
|
|
|
|
|
|
|
|
|
- "import module" now compiles module.pyw if it exists and nothing else
|
|
|
|
|
relevant is found.
|
|
|
|
|
|
2001-07-20 23:31:40 -03:00
|
|
|
|
|
2001-07-17 14:22:32 -03:00
|
|
|
|
What's New in Python 2.2a1?
|
2001-10-25 18:53:30 -03:00
|
|
|
|
Release date: 18-Jul-2001
|
2001-05-01 17:45:31 -03:00
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
Core
|
2001-05-14 04:05:58 -03:00
|
|
|
|
|
2001-08-02 01:15:00 -03:00
|
|
|
|
- TENTATIVELY, a large amount of code implementing much of what's
|
|
|
|
|
described in PEP 252 (Making Types Look More Like Classes) and PEP
|
|
|
|
|
253 (Subtyping Built-in Types) was added. This will be released
|
|
|
|
|
with Python 2.2a1. Documentation will be provided separately
|
|
|
|
|
through http://www.python.org/2.2/. The purpose of releasing this
|
|
|
|
|
with Python 2.2a1 is to test backwards compatibility. It is
|
|
|
|
|
possible, though not likely, that a decision is made not to release
|
|
|
|
|
this code as part of 2.2 final, if any serious backwards
|
|
|
|
|
incompapatibilities are found during alpha testing that cannot be
|
|
|
|
|
repaired.
|
|
|
|
|
|
2001-07-17 14:22:32 -03:00
|
|
|
|
- Generators were added; this is a new way to create an iterator (see
|
2001-07-17 15:48:00 -03:00
|
|
|
|
below) using what looks like a simple function containing one or
|
2001-07-17 14:22:32 -03:00
|
|
|
|
more 'yield' statements. See PEP 255. Since this adds a new
|
|
|
|
|
keyword to the language, this feature must be enabled by including a
|
|
|
|
|
future statement: "from __future__ import generators" (see PEP 236).
|
|
|
|
|
Generators will become a standard feature in a future release
|
|
|
|
|
(probably 2.3). Without this future statement, 'yield' remains an
|
|
|
|
|
ordinary identifier, but a warning is issued each time it is used.
|
|
|
|
|
(These warnings currently don't conform to the warnings framework of
|
|
|
|
|
PEP 230; we intend to fix this in 2.2a2.)
|
|
|
|
|
|
2001-05-22 05:58:23 -03:00
|
|
|
|
- The UTF-16 codec was modified to be more RFC compliant. It will now
|
|
|
|
|
only remove BOM characters at the start of the string and then
|
|
|
|
|
only if running in native mode (UTF-16-LE and -BE won't remove a
|
|
|
|
|
leading BMO character).
|
|
|
|
|
|
2001-05-15 15:38:45 -03:00
|
|
|
|
- Strings now have a new method .decode() to complement the already
|
|
|
|
|
existing .encode() method. These two methods provide direct access
|
|
|
|
|
to the corresponding decoders and encoders of the registered codecs.
|
|
|
|
|
|
|
|
|
|
To enhance the usability of the .encode() method, the special
|
|
|
|
|
casing of Unicode object return values was dropped (Unicode objects
|
|
|
|
|
were auto-magically converted to string using the default encoding).
|
2001-06-02 02:27:19 -03:00
|
|
|
|
|
2001-05-15 15:38:45 -03:00
|
|
|
|
Both methods will now return whatever the codec in charge of the
|
|
|
|
|
requested encoding returns as object, e.g. Unicode codecs will
|
|
|
|
|
return Unicode objects when decoding is requested ("<22><><EFBFBD>".decode("latin-1")
|
|
|
|
|
will return u"<22><><EFBFBD>"). This enables codec writer to create codecs
|
|
|
|
|
for various simple to use conversions.
|
|
|
|
|
|
|
|
|
|
New codecs were added to demonstrate these new features (the .encode()
|
|
|
|
|
and .decode() columns indicate the type of the returned objects):
|
|
|
|
|
|
|
|
|
|
Name | .encode() | .decode() | Description
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
uu | string | string | UU codec (e.g. for email)
|
|
|
|
|
base64 | string | string | base64 codec
|
2001-06-06 10:30:54 -03:00
|
|
|
|
quopri | string | string | quoted-printable codec
|
2001-05-15 15:38:45 -03:00
|
|
|
|
zlib | string | string | zlib compression
|
|
|
|
|
hex | string | string | 2-byte hex codec
|
|
|
|
|
rot-13 | string | Unicode | ROT-13 Unicode charmap codec
|
|
|
|
|
|
2001-05-14 00:09:36 -03:00
|
|
|
|
- Some operating systems now support the concept of a default Unicode
|
|
|
|
|
encoding for file system operations. Notably, Windows supports 'mbcs'
|
|
|
|
|
as the default. The Macintosh will also adopt this concept in the medium
|
2001-05-14 10:53:38 -03:00
|
|
|
|
term, although the default encoding for that platform will be other than
|
2001-05-14 00:09:36 -03:00
|
|
|
|
'mbcs'.
|
2001-05-14 10:53:38 -03:00
|
|
|
|
|
|
|
|
|
On operating system that support non-ASCII filenames, it is common for
|
2001-05-14 00:09:36 -03:00
|
|
|
|
functions that return filenames (such as os.listdir()) to return Python
|
|
|
|
|
string objects pre-encoded using the default file system encoding for
|
|
|
|
|
the platform. As this encoding is likely to be different from Python's
|
|
|
|
|
default encoding, converting this name to a Unicode object before passing
|
|
|
|
|
it back to the Operating System would result in a Unicode error, as Python
|
2001-05-14 04:05:58 -03:00
|
|
|
|
would attempt to use its default encoding (generally ASCII) rather than
|
|
|
|
|
the default encoding for the file system.
|
2001-05-14 10:53:38 -03:00
|
|
|
|
|
2001-05-14 04:05:58 -03:00
|
|
|
|
In general, this change simply removes surprises when working with
|
|
|
|
|
Unicode and the file system, making these operations work as you expect,
|
|
|
|
|
increasing the transparency of Unicode objects in this context.
|
2001-05-14 00:09:36 -03:00
|
|
|
|
See [????] for more details, including examples.
|
2001-05-01 17:45:31 -03:00
|
|
|
|
|
2001-05-08 12:43:37 -03:00
|
|
|
|
- Float (and complex) literals in source code were evaluated to full
|
|
|
|
|
precision only when running from a .py file; the same code loaded from a
|
|
|
|
|
.pyc (or .pyo) file could suffer numeric differences starting at about the
|
|
|
|
|
12th significant decimal digit. For example, on a machine with IEEE-754
|
|
|
|
|
floating arithmetic,
|
|
|
|
|
|
|
|
|
|
x = 9007199254740992.0
|
|
|
|
|
print long(x)
|
|
|
|
|
|
|
|
|
|
printed 9007199254740992 if run directly from .py, but 9007199254740000
|
|
|
|
|
if from a compiled (.pyc or .pyo) file. This was due to marshal using
|
|
|
|
|
str(float) instead of repr(float) when building code objects. marshal
|
|
|
|
|
now uses repr(float) instead, which should reproduce floats to full
|
|
|
|
|
machine precision (assuming the platform C float<->string I/O conversion
|
|
|
|
|
functions are of good quality).
|
|
|
|
|
|
|
|
|
|
This may cause floating-point results to change in some cases, and
|
|
|
|
|
usually for the better, but may also cause numerically unstable
|
|
|
|
|
algorithms to break.
|
|
|
|
|
|
Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".
The comment following used to say:
/* We use ~hash instead of hash, as degenerate hash functions, such
as for ints <sigh>, can have lots of leading zeros. It's not
really a performance risk, but better safe than sorry.
12-Dec-00 tim: so ~hash produces lots of leading ones instead --
what's the gain? */
That is, there was never a good reason for doing it. And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) & mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.
Changing to the simpler "i = hash & mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.
Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items(). A number
of std tests suffered bogus failures as a result. For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,
>>> d = {}
>>> for i in range(10):
... d[i] = i
...
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>
Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.
test_support.py
Moved test_extcall's sortdict() into test_support, made it stronger,
and imported sortdict into other std tests that needed it.
test_unicode.py
Excluced cp875 from the "roundtrip over range(128)" test, because
cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
See Python-Dev for excruciating details.
Cookie.py
Chaged various output functions to sort dicts before building
strings from them.
test_extcall
Fiddled the expected-result file. This remains sensitive to native
dict ordering, because, e.g., if there are multiple errors in a
keyword-arg dict (and test_extcall sets up many cases like that), the
specific error Python complains about first depends on native dict
ordering.
2001-05-12 21:19:31 -03:00
|
|
|
|
- The implementation of dicts suffers fewer collisions, which has speed
|
|
|
|
|
benefits. However, the order in which dict entries appear in dict.keys(),
|
|
|
|
|
dict.values() and dict.items() may differ from previous releases for a
|
|
|
|
|
given dict. Nothing is defined about this order, so no program should
|
|
|
|
|
rely on it. Nevertheless, it's easy to write test cases that rely on the
|
|
|
|
|
order by accident, typically because of printing the str() or repr() of a
|
|
|
|
|
dict to an "expected results" file. See Lib/test/test_support.py's new
|
|
|
|
|
sortdict(dict) function for a simple way to display a dict in sorted
|
|
|
|
|
order.
|
|
|
|
|
|
2001-06-11 22:22:22 -03:00
|
|
|
|
- Many other small changes to dicts were made, resulting in faster
|
|
|
|
|
operation along the most common code paths.
|
|
|
|
|
|
2001-05-01 17:54:30 -03:00
|
|
|
|
- Dictionary objects now support the "in" operator: "x in dict" means
|
|
|
|
|
the same as dict.has_key(x).
|
|
|
|
|
|
2001-06-26 17:12:50 -03:00
|
|
|
|
- The update() method of dictionaries now accepts generic mapping
|
|
|
|
|
objects. Specifically the argument object must support the .keys()
|
|
|
|
|
and __getitem__() methods. This allows you to say, for example,
|
|
|
|
|
{}.update(UserDict())
|
|
|
|
|
|
2001-05-01 17:54:30 -03:00
|
|
|
|
- Iterators were added; this is a generalized way of providing values
|
|
|
|
|
to a for loop. See PEP 234. There's a new built-in function iter()
|
|
|
|
|
to return an iterator. There's a new protocol to get the next value
|
|
|
|
|
from an iterator using the next() method (in Python) or the
|
|
|
|
|
tp_iternext slot (in C). There's a new protocol to get iterators
|
|
|
|
|
using the __iter__() method (in Python) or the tp_iter slot (in C).
|
|
|
|
|
Iterating (i.e. a for loop) over a dictionary generates its keys.
|
|
|
|
|
Iterating over a file generates its lines.
|
|
|
|
|
|
2001-05-01 17:45:31 -03:00
|
|
|
|
- The following functions were generalized to work nicely with iterator
|
|
|
|
|
arguments:
|
2001-05-08 01:38:29 -03:00
|
|
|
|
map(), filter(), reduce(), zip()
|
2001-05-05 22:05:02 -03:00
|
|
|
|
list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
|
|
|
|
|
max(), min()
|
2001-05-26 16:37:54 -03:00
|
|
|
|
join() method of strings
|
|
|
|
|
extend() method of lists
|
2001-05-05 08:33:43 -03:00
|
|
|
|
'x in y' and 'x not in y' (PySequence_Contains() in C API)
|
|
|
|
|
operator.countOf() (PySequence_Count() in C API)
|
2001-06-20 23:49:55 -03:00
|
|
|
|
right-hand side of assignment statements with multiple targets, such as
|
|
|
|
|
x, y, z = some_iterable_object_returning_exactly_3_values
|
2001-05-05 08:33:43 -03:00
|
|
|
|
|
2001-05-11 18:51:48 -03:00
|
|
|
|
- Accessing module attributes is significantly faster (for example,
|
|
|
|
|
random.random or os.path or yourPythonModule.yourAttribute).
|
|
|
|
|
|
2001-05-08 01:38:29 -03:00
|
|
|
|
- Comparing dictionary objects via == and != is faster, and now works even
|
|
|
|
|
if the keys and values don't support comparisons other than ==.
|
|
|
|
|
|
2001-05-10 05:32:44 -03:00
|
|
|
|
- Comparing dictionaries in ways other than == and != is slower: there were
|
|
|
|
|
insecurities in the dict comparison implementation that could cause Python
|
|
|
|
|
to crash if the element comparison routines for the dict keys and/or
|
|
|
|
|
values mutated the dicts. Making the code bulletproof slowed it down.
|
|
|
|
|
|
2001-06-02 02:27:19 -03:00
|
|
|
|
- Collisions in dicts are resolved via a new approach, which can help
|
|
|
|
|
dramatically in bad cases. For example, looking up every key in a dict
|
2001-06-11 22:22:22 -03:00
|
|
|
|
d with d.keys() == [i << 16 for i in range(20000)] is approximately 500x
|
2001-06-02 02:27:19 -03:00
|
|
|
|
faster now. Thanks to Christian Tismer for pointing out the cause and
|
|
|
|
|
the nature of an effective cure (last December! better late than never).
|
2001-05-27 04:39:22 -03:00
|
|
|
|
|
2001-06-16 02:42:57 -03:00
|
|
|
|
- repr() is much faster for large containers (dict, list, tuple).
|
|
|
|
|
|
|
|
|
|
|
2001-05-14 04:05:58 -03:00
|
|
|
|
Library
|
|
|
|
|
|
2001-07-20 15:38:26 -03:00
|
|
|
|
- The constants ascii_letters, ascii_lowercase. and ascii_uppercase
|
|
|
|
|
were added to the string module. These a locale-indenpendent
|
|
|
|
|
constants, unlike letters, lowercase, and uppercase. These are now
|
|
|
|
|
use in appropriate locations in the standard library.
|
|
|
|
|
|
2001-07-18 13:17:16 -03:00
|
|
|
|
- The flags used in dlopen calls can now be configured using
|
|
|
|
|
sys.setdlopenflags and queried using sys.getdlopenflags.
|
|
|
|
|
|
2001-07-12 08:54:37 -03:00
|
|
|
|
- Fredrik Lundh's xmlrpclib is now a standard library module. This
|
|
|
|
|
provides full client-side XML-RPC support. In addition,
|
|
|
|
|
Demo/xmlrpc/ contains two server frameworks (one SocketServer-based,
|
|
|
|
|
one asyncore-based). Thanks to Eric Raymond for the documentation.
|
|
|
|
|
|
2001-07-05 11:46:25 -03:00
|
|
|
|
- The xrange() object is simplified: it no longer supports slicing,
|
|
|
|
|
repetition, comparisons, efficient 'in' checking, the tolist()
|
|
|
|
|
method, or the start, stop and step attributes. See PEP 260.
|
|
|
|
|
|
2001-06-06 03:25:40 -03:00
|
|
|
|
- A new function fnmatch.filter to filter lists of file names was added.
|
|
|
|
|
|
2001-05-22 13:00:10 -03:00
|
|
|
|
- calendar.py uses month and day names based on the current locale.
|
|
|
|
|
|
2001-05-14 23:14:44 -03:00
|
|
|
|
- strop is now *really* obsolete (this was announced before with 1.6),
|
|
|
|
|
and issues DeprecationWarning when used (except for the four items
|
|
|
|
|
that are still imported into string.py).
|
|
|
|
|
|
2001-05-14 04:05:58 -03:00
|
|
|
|
- Cookie.py now sorts key+value pairs by key in output strings.
|
|
|
|
|
|
|
|
|
|
- pprint.isrecursive(object) didn't correctly identify recursive objects.
|
|
|
|
|
Now it does.
|
|
|
|
|
|
2001-05-14 15:39:41 -03:00
|
|
|
|
- pprint functions now much faster for large containers (tuple, list, dict).
|
|
|
|
|
|
2001-06-10 20:40:19 -03:00
|
|
|
|
- New 'q' and 'Q' format codes in the struct module, corresponding to C
|
|
|
|
|
types "long long" and "unsigned long long" (on Windows, __int64). In
|
|
|
|
|
native mode, these can be used only when the platform C compiler supports
|
|
|
|
|
these types (when HAVE_LONG_LONG is #define'd by the Python config
|
|
|
|
|
process), and then they inherit the sizes and alignments of the C types.
|
2001-06-11 22:22:22 -03:00
|
|
|
|
In standard mode, 'q' and 'Q' are supported on all platforms, and are
|
|
|
|
|
8-byte integral types.
|
2001-06-10 20:40:19 -03:00
|
|
|
|
|
2001-06-12 13:48:52 -03:00
|
|
|
|
- The site module installs a new built-in function 'help' that invokes
|
|
|
|
|
pydoc.help. It must be invoked as 'help()'; when invoked as 'help',
|
|
|
|
|
it displays a message reminding the user to use 'help()' or
|
|
|
|
|
'help(object)'.
|
|
|
|
|
|
2001-05-14 04:05:58 -03:00
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
- New test_mutants.py runs dict comparisons where the key and value
|
|
|
|
|
comparison operators mutute the dicts randomly during comparison. This
|
|
|
|
|
rapidly causes Python to crash under earlier releases (not for the faint
|
|
|
|
|
of heart: it can also cause Win9x to freeze or reboot!).
|
|
|
|
|
|
|
|
|
|
- New test_pprint.py verfies that pprint.isrecursive() and
|
2001-05-14 15:39:41 -03:00
|
|
|
|
pprint.isreadable() return sensible results. Also verifies that simple
|
|
|
|
|
cases produce correct output.
|
2001-05-14 04:05:58 -03:00
|
|
|
|
|
2001-05-28 19:30:08 -03:00
|
|
|
|
C API
|
|
|
|
|
|
|
|
|
|
- Removed the unused last_is_sticky argument from the internal
|
|
|
|
|
_PyTuple_Resize(). If this affects you, you were cheating.
|
|
|
|
|
|
|
|
|
|
|
2001-07-17 14:22:32 -03:00
|
|
|
|
======================================================================
|
|
|
|
|
|
|
|
|
|
|
2001-04-16 15:46:45 -03:00
|
|
|
|
What's New in Python 2.1 (final)?
|
|
|
|
|
=================================
|
|
|
|
|
|
|
|
|
|
We only changed a few things since the last release candidate, all in
|
|
|
|
|
Python library code:
|
|
|
|
|
|
|
|
|
|
- A bug in the locale module was fixed that affected locales which
|
|
|
|
|
define no grouping for numeric formatting.
|
|
|
|
|
|
|
|
|
|
- A few bugs in the weakref module's implementations of weak
|
|
|
|
|
dictionaries (WeakValueDictionary and WeakKeyDictionary) were fixed,
|
|
|
|
|
and the test suite was updated to check for these bugs.
|
|
|
|
|
|
|
|
|
|
- An old bug in the os.path.walk() function (introduced in Python
|
|
|
|
|
2.0!) was fixed: a non-existent file would cause an exception
|
|
|
|
|
instead of being ignored.
|
|
|
|
|
|
|
|
|
|
- Fixed a few bugs in the new symtable module found by Neil Norwitz's
|
|
|
|
|
PyChecker.
|
|
|
|
|
|
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
What's New in Python 2.1c2?
|
|
|
|
|
===========================
|
2001-04-11 17:37:57 -03:00
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
A flurry of small changes, and one showstopper fixed in the nick of
|
|
|
|
|
time made it necessary to release another release candidate. The list
|
|
|
|
|
here is the *complete* list of patches (except version updates):
|
2001-04-12 21:46:14 -03:00
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
Core
|
2001-04-12 21:46:14 -03:00
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
- Tim discovered a nasty bug in the dictionary code, caused by
|
|
|
|
|
PyDict_Next() calling dict_resize(), and the GC code's use of
|
|
|
|
|
PyDict_Next() violating an assumption in dict_items(). This was
|
|
|
|
|
fixed with considerable amounts of band-aid, but the net effect is a
|
|
|
|
|
saner and more robust implementation.
|
|
|
|
|
|
|
|
|
|
- Made a bunch of symbols static that were accidentally global.
|
|
|
|
|
|
|
|
|
|
Build and Ports
|
|
|
|
|
|
|
|
|
|
- The setup.py script didn't check for a new enough version of zlib
|
|
|
|
|
(1.1.3 is needed). Now it does.
|
|
|
|
|
|
|
|
|
|
- Changed "make clean" target to also remove shared libraries.
|
|
|
|
|
|
|
|
|
|
- Added a more general warning about the SGI Irix optimizer to README.
|
|
|
|
|
|
|
|
|
|
Library
|
|
|
|
|
|
|
|
|
|
- Fix a bug in urllib.basejoin("http://host", "../file.html") which
|
|
|
|
|
omitted the slash between host and file.html.
|
|
|
|
|
|
|
|
|
|
- The mailbox module's _Mailbox class contained a completely broken
|
|
|
|
|
and undocumented seek() method. Ripped it out.
|
|
|
|
|
|
|
|
|
|
- Fixed a bunch of typos in various library modules (urllib2, smtpd,
|
|
|
|
|
sgmllib, netrc, chunk) found by Neil Norwitz's PyChecker.
|
|
|
|
|
|
|
|
|
|
- Fixed a few last-minute bugs in unittest.
|
|
|
|
|
|
|
|
|
|
Extensions
|
|
|
|
|
|
|
|
|
|
- Reverted the patch to the OpenSSL code in socketmodule.c to support
|
|
|
|
|
RAND_status() and the EGD, and the subsequent patch that tried to
|
|
|
|
|
fix it for pre-0.9.5 versions; the problem with the patch is that on
|
|
|
|
|
some systems it issues a warning whenever socket is imported, and
|
|
|
|
|
that's unacceptable.
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
- Fixed the pickle tests to work with "import test.test_pickle".
|
|
|
|
|
|
|
|
|
|
- Tweaked test_locale.py to actually run the test Windows.
|
|
|
|
|
|
|
|
|
|
- In distutils/archive_util.py, call zipfile.ZipFile() with mode "w",
|
|
|
|
|
not "wb" (which is not a valid mode at all).
|
|
|
|
|
|
|
|
|
|
- Fix pstats browser crashes. Import readline if it exists to make
|
|
|
|
|
the user interface nicer.
|
|
|
|
|
|
|
|
|
|
- Add "import thread" to the top of test modules that import the
|
|
|
|
|
threading module (test_asynchat and test_threadedtempfile). This
|
|
|
|
|
prevents test failures caused by a broken threading module resulting
|
|
|
|
|
from a previously caught failed import.
|
|
|
|
|
|
|
|
|
|
- Changed test_asynchat.py to set the SO_REUSEADDR option; this was
|
|
|
|
|
needed on some platforms (e.g. Solaris 8) when the tests are run
|
|
|
|
|
twice in succession.
|
|
|
|
|
|
|
|
|
|
- Skip rather than fail test_sunaudiodev if no audio device is found.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
What's New in Python 2.1c1?
|
|
|
|
|
===========================
|
|
|
|
|
|
|
|
|
|
This list was significantly updated when 2.1c2 was released; the 2.1c1
|
|
|
|
|
release didn't mention most changes that were actually part of 2.1c1:
|
|
|
|
|
|
|
|
|
|
Legal
|
|
|
|
|
|
|
|
|
|
- Copyright was assigned to the Python Software Foundation (PSF) and a
|
|
|
|
|
PSF license (very similar to the CNRI license) was added.
|
|
|
|
|
|
|
|
|
|
- The CNRI copyright notice was updated to include 2001.
|
|
|
|
|
|
|
|
|
|
Core
|
2001-04-11 17:37:57 -03:00
|
|
|
|
|
2001-04-11 23:31:27 -03:00
|
|
|
|
- After a public outcry, assignment to __debug__ is no longer illegal;
|
|
|
|
|
instead, a warning is issued. It will become illegal in 2.2.
|
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
- Fixed a core dump with "%#x" % 0, and changed the semantics so that
|
|
|
|
|
"%#x" now always prepends "0x", even if the value is zero.
|
|
|
|
|
|
|
|
|
|
- Fixed some nits in the bytecode compiler.
|
|
|
|
|
|
|
|
|
|
- Fixed core dumps when calling certain kinds of non-functions.
|
|
|
|
|
|
|
|
|
|
- Fixed various core dumps caused by reference count bugs.
|
|
|
|
|
|
|
|
|
|
Build and Ports
|
|
|
|
|
|
|
|
|
|
- Use INSTALL_SCRIPT to install script files.
|
|
|
|
|
|
2001-04-11 18:03:32 -03:00
|
|
|
|
- New port: SCO Unixware 7, by Billy G. Allie.
|
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
- Updated RISCOS port.
|
|
|
|
|
|
|
|
|
|
- Updated BeOS port and notes.
|
|
|
|
|
|
|
|
|
|
- Various other porting problems resolved.
|
|
|
|
|
|
|
|
|
|
Library
|
|
|
|
|
|
|
|
|
|
- The TERMIOS and SOCKET modules are now truly obsolete and
|
|
|
|
|
unnecessary. Their symbols are incorporated in the termios and
|
|
|
|
|
socket modules.
|
|
|
|
|
|
|
|
|
|
- Fixed some 64-bit bugs in pickle, cPickle, and struct, and added
|
|
|
|
|
better tests for pickling.
|
|
|
|
|
|
|
|
|
|
- threading: make Condition.wait() robust against KeyboardInterrupt.
|
|
|
|
|
|
|
|
|
|
- zipfile: add support to zipfile to support opening an archive
|
|
|
|
|
represented by an open file rather than a file name. Fix bug where
|
|
|
|
|
the archive was not properly closed. Fixed a bug in this bugfix
|
|
|
|
|
where flush() was called for a read-only file.
|
|
|
|
|
|
|
|
|
|
- imputil: added an uninstall() method to the ImportManager.
|
|
|
|
|
|
|
|
|
|
- Canvas: fixed bugs in lower() and tkraise() methods.
|
|
|
|
|
|
|
|
|
|
- SocketServer: API change (added overridable close_request() method)
|
|
|
|
|
so that the TCP server can explicitly close the request.
|
|
|
|
|
|
|
|
|
|
- pstats: Eric Raymond added a simple interactive statistics browser,
|
|
|
|
|
invoked when the module is run as a script.
|
|
|
|
|
|
|
|
|
|
- locale: fixed a problem in format().
|
|
|
|
|
|
|
|
|
|
- webbrowser: made it work when the BROWSER environment variable has a
|
|
|
|
|
value like "/usr/bin/netscape". Made it auto-detect Konqueror for
|
|
|
|
|
KDE 2. Fixed some other nits.
|
|
|
|
|
|
|
|
|
|
- unittest: changes to allow using a different exception than
|
|
|
|
|
AssertionError, and added a few more function aliases. Some other
|
|
|
|
|
small changes.
|
|
|
|
|
|
|
|
|
|
- urllib, urllib2: fixed redirect problems and a coupleof other nits.
|
|
|
|
|
|
|
|
|
|
- asynchat: fixed a critical bug in asynchat that slipped through the
|
|
|
|
|
2.1b2 release. Fixed another rare bug.
|
|
|
|
|
|
|
|
|
|
- Fix some unqualified except: clauses (always a bad code example).
|
|
|
|
|
|
|
|
|
|
XML
|
|
|
|
|
|
|
|
|
|
- pyexpat: new API get_version_string().
|
|
|
|
|
|
|
|
|
|
- Fixed some minidom bugs.
|
|
|
|
|
|
|
|
|
|
Extensions
|
|
|
|
|
|
|
|
|
|
- Fixed a core dump in _weakref. Removed the weakref.mapping()
|
|
|
|
|
function (it adds nothing to the API).
|
|
|
|
|
|
|
|
|
|
- Rationalized the use of header files in the readline module, to make
|
|
|
|
|
it compile (albeit with some warnings) with the very recent readline
|
|
|
|
|
4.2, without breaking for earlier versions.
|
|
|
|
|
|
|
|
|
|
- Hopefully fixed a buffering problem in linuxaudiodev.
|
|
|
|
|
|
|
|
|
|
- Attempted a fix to make the OpenSSL support in the socket module
|
|
|
|
|
work again with pre-0.9.5 versions of OpenSSL.
|
|
|
|
|
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
- Added a test case for asynchat and asyncore.
|
|
|
|
|
|
|
|
|
|
- Removed coupling between tests where one test failing could break
|
|
|
|
|
another.
|
|
|
|
|
|
|
|
|
|
Tools
|
|
|
|
|
|
|
|
|
|
- Ping added an interactive help browser to pydoc, fixed some nits
|
|
|
|
|
in the rest of the pydoc code, and added some features to his
|
|
|
|
|
inspect module.
|
|
|
|
|
|
|
|
|
|
- An updated python-mode.el version 4.1 which integrates Ken
|
|
|
|
|
Manheimer's pdbtrack.el. This makes debugging Python code via pdb
|
|
|
|
|
much nicer in XEmacs and Emacs. When stepping through your program
|
|
|
|
|
with pdb, in either the shell window or the *Python* window, the
|
|
|
|
|
source file and line will be tracked by an arrow. Very cool!
|
|
|
|
|
|
|
|
|
|
- IDLE: syntax warnings in interactive mode are changed into errors.
|
|
|
|
|
|
|
|
|
|
- Some improvements to Tools/webchecker (ignore some more URL types,
|
2001-05-02 04:39:38 -03:00
|
|
|
|
follow some more links).
|
2001-04-15 23:05:23 -03:00
|
|
|
|
|
|
|
|
|
- Brought the Tools/compiler package up to date.
|
2001-04-11 18:03:32 -03:00
|
|
|
|
|
2001-04-11 17:37:57 -03:00
|
|
|
|
|
2001-03-21 04:01:39 -04:00
|
|
|
|
What's New in Python 2.1 beta 2?
|
|
|
|
|
================================
|
|
|
|
|
|
2001-03-22 10:17:21 -04:00
|
|
|
|
(Unlisted are many fixed bugs, more documentation, etc.)
|
|
|
|
|
|
2001-03-21 04:01:39 -04:00
|
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
|
2001-03-22 10:17:21 -04:00
|
|
|
|
- The nested scopes work (enabled by "from __future__ import
|
|
|
|
|
nested_scopes") is completed; in particular, the future now extends
|
|
|
|
|
into code executed through exec, eval() and execfile(), and into the
|
|
|
|
|
interactive interpreter.
|
|
|
|
|
|
|
|
|
|
- When calling a base class method (e.g. BaseClass.__init__(self)),
|
|
|
|
|
this is now allowed even if self is not strictly spoken a class
|
|
|
|
|
instance (e.g. when using metaclasses or the Don Beaudry hook).
|
|
|
|
|
|
|
|
|
|
- Slice objects are now comparable but not hashable; this prevents
|
|
|
|
|
dict[:] from being accepted but meaningless.
|
|
|
|
|
|
|
|
|
|
- Complex division is now calculated using less braindead algorithms.
|
|
|
|
|
This doesn't change semantics except it's more likely to give useful
|
|
|
|
|
results in extreme cases. Complex repr() now uses full precision
|
|
|
|
|
like float repr().
|
|
|
|
|
|
|
|
|
|
- sgmllib.py now calls handle_decl() for simple <!...> declarations.
|
|
|
|
|
|
2001-03-23 10:18:27 -04:00
|
|
|
|
- It is illegal to assign to the name __debug__, which is set when the
|
|
|
|
|
interpreter starts. It is effectively a compile-time constant.
|
|
|
|
|
|
|
|
|
|
- A warning will be issued if a global statement for a variable
|
|
|
|
|
follows a use or assignment of that variable.
|
|
|
|
|
|
2001-03-21 04:01:39 -04:00
|
|
|
|
Standard library
|
|
|
|
|
|
2001-03-22 10:17:21 -04:00
|
|
|
|
- unittest.py, a unit testing framework by Steve Purcell (PyUNIT,
|
|
|
|
|
inspired by JUnit), is now part of the standard library. You now
|
|
|
|
|
have a choice of two testing frameworks: unittest requires you to
|
|
|
|
|
write testcases as separate code, doctest gathers them from
|
|
|
|
|
docstrings. Both approaches have their advantages and
|
|
|
|
|
disadvantages.
|
|
|
|
|
|
|
|
|
|
- A new module Tix was added, which wraps the Tix extension library
|
|
|
|
|
for Tk. With that module, it is not necessary to statically link
|
|
|
|
|
Tix with _tkinter, since Tix will be loaded with Tcl's "package
|
|
|
|
|
require" command. See Demo/tix/.
|
|
|
|
|
|
|
|
|
|
- tzparse.py is now obsolete.
|
|
|
|
|
|
|
|
|
|
- In gzip.py, the seek() and tell() methods are removed -- they were
|
|
|
|
|
non-functional anyway, and it's better if callers can test for their
|
|
|
|
|
existence with hasattr().
|
|
|
|
|
|
|
|
|
|
Python/C API
|
|
|
|
|
|
|
|
|
|
- PyDict_Next(): it is now safe to call PyDict_SetItem() with a key
|
|
|
|
|
that's already in the dictionary during a PyDict_Next() iteration.
|
|
|
|
|
This used to fail occasionally when a dictionary resize operation
|
|
|
|
|
could be triggered that would rehash all the keys. All other
|
|
|
|
|
modifications to the dictionary are still off-limits during a
|
|
|
|
|
PyDict_Next() iteration!
|
|
|
|
|
|
|
|
|
|
- New extended APIs related to passing compiler variables around.
|
|
|
|
|
|
|
|
|
|
- New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass()
|
|
|
|
|
implement isinstance() and issubclass().
|
|
|
|
|
|
|
|
|
|
- Py_BuildValue() now has a "D" conversion to create a Python complex
|
|
|
|
|
number from a Py_complex C value.
|
2001-03-21 04:01:39 -04:00
|
|
|
|
|
2001-03-22 14:26:47 -04:00
|
|
|
|
- Extensions types which support weak references must now set the
|
|
|
|
|
field allocated for the weak reference machinery to NULL themselves;
|
|
|
|
|
this is done to avoid the cost of checking each object for having a
|
|
|
|
|
weakly referencable type in PyObject_INIT(), since most types are
|
|
|
|
|
not weakly referencable.
|
|
|
|
|
|
2001-03-23 10:18:27 -04:00
|
|
|
|
- PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for
|
|
|
|
|
free variables and cell variables to and from the frame's f_locals.
|
|
|
|
|
|
|
|
|
|
- Variants of several functions defined in pythonrun.h have been added
|
|
|
|
|
to support the nested_scopes future statement. The variants all end
|
|
|
|
|
in Flags and take an extra argument, a PyCompilerFlags *; examples:
|
|
|
|
|
PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These
|
|
|
|
|
variants may be removed in Python 2.2, when nested scopes are
|
2001-05-02 04:39:38 -03:00
|
|
|
|
mandatory.
|
2001-03-23 10:18:27 -04:00
|
|
|
|
|
2001-03-22 11:42:08 -04:00
|
|
|
|
Distutils
|
|
|
|
|
|
|
|
|
|
- the sdist command now writes a PKG-INFO file, as described in PEP 241,
|
|
|
|
|
into the release tree.
|
|
|
|
|
|
2001-05-02 04:39:38 -03:00
|
|
|
|
- several enhancements to the bdist_wininst command from Thomas Heller
|
2001-03-22 11:42:08 -04:00
|
|
|
|
(an uninstaller, more customization of the installer's display)
|
|
|
|
|
|
|
|
|
|
- from Jack Jansen: added Mac-specific code to generate a dialog for
|
|
|
|
|
users to specify the command-line (because providing a command-line with
|
2001-05-02 04:39:38 -03:00
|
|
|
|
MacPython is awkward). Jack also made various fixes for the Mac
|
2001-03-22 11:42:08 -04:00
|
|
|
|
and the Metrowerks compiler.
|
2001-05-02 04:39:38 -03:00
|
|
|
|
|
|
|
|
|
- added 'platforms' and 'keywords' to the set of metadata that can be
|
|
|
|
|
specified for a distribution.
|
2001-03-22 11:42:08 -04:00
|
|
|
|
|
|
|
|
|
- applied patches from Jason Tishler to make the compiler class work with
|
|
|
|
|
Cygwin.
|
|
|
|
|
|
|
|
|
|
|
2001-03-01 18:19:38 -04:00
|
|
|
|
What's New in Python 2.1 beta 1?
|
|
|
|
|
================================
|
2001-02-03 23:09:53 -04:00
|
|
|
|
|
|
|
|
|
Core language, builtins, and interpreter
|
|
|
|
|
|
2001-03-02 10:00:32 -04:00
|
|
|
|
- Following an outcry from the community about the amount of code
|
|
|
|
|
broken by the nested scopes feature introduced in 2.1a2, we decided
|
|
|
|
|
to make this feature optional, and to wait until Python 2.2 (or at
|
|
|
|
|
least 6 months) to make it standard. The option can be enabled on a
|
|
|
|
|
per-module basis by adding "from __future__ import nested_scopes" at
|
|
|
|
|
the beginning of a module (before any other statements, but after
|
|
|
|
|
comments and an optional docstring). See PEP 236 (Back to the
|
|
|
|
|
__future__) for a description of the __future__ statement. PEP 227
|
|
|
|
|
(Statically Nested Scopes) has been updated to reflect this change,
|
|
|
|
|
and to clarify the semantics in a number of endcases.
|
|
|
|
|
|
|
|
|
|
- The nested scopes code, when enabled, has been hardened, and most
|
|
|
|
|
bugs and memory leaks in it have been fixed.
|
|
|
|
|
|
|
|
|
|
- Compile-time warnings are now generated for a number of conditions
|
|
|
|
|
that will break or change in meaning when nested scopes are enabled:
|
|
|
|
|
|
|
|
|
|
- Using "from...import *" or "exec" without in-clause in a function
|
|
|
|
|
scope that also defines a lambda or nested function with one or
|
|
|
|
|
more free (non-local) variables. The presence of the import* or
|
|
|
|
|
bare exec makes it impossible for the compiler to determine the
|
|
|
|
|
exact set of local variables in the outer scope, which makes it
|
|
|
|
|
impossible to determine the bindings for free variables in the
|
|
|
|
|
inner scope. To avoid the warning about import *, change it into
|
|
|
|
|
an import of explicitly name object, or move the import* statement
|
|
|
|
|
to the global scope; to avoid the warning about bare exec, use
|
|
|
|
|
exec...in... (a good idea anyway -- there's a possibility that
|
|
|
|
|
bare exec will be deprecated in the future).
|
|
|
|
|
|
|
|
|
|
- Use of a global variable in a nested scope with the same name as a
|
|
|
|
|
local variable in a surrounding scope. This will change in
|
|
|
|
|
meaning with nested scopes: the name in the inner scope will
|
|
|
|
|
reference the variable in the outer scope rather than the global
|
|
|
|
|
of the same name. To avoid the warning, either rename the outer
|
|
|
|
|
variable, or use a global statement in the inner function.
|
|
|
|
|
|
2001-02-27 00:45:05 -04:00
|
|
|
|
- An optional object allocator has been included. This allocator is
|
|
|
|
|
optimized for Python objects and should be faster and use less memory
|
|
|
|
|
than the standard system allocator. It is not enabled by default
|
|
|
|
|
because of possible thread safety problems. The allocator is only
|
|
|
|
|
protected by the Python interpreter lock and it is possible that some
|
|
|
|
|
extension modules require a thread safe allocator. The object
|
|
|
|
|
allocator can be enabled by providing the "--with-pymalloc" option to
|
|
|
|
|
configure.
|
|
|
|
|
|
2001-02-03 23:09:53 -04:00
|
|
|
|
Standard library
|
|
|
|
|
|
2001-02-27 00:21:58 -04:00
|
|
|
|
- pyexpat now detects the expat version if expat.h defines it. A
|
|
|
|
|
number of additional handlers are provided, which are only available
|
|
|
|
|
since expat 1.95. In addition, the methods SetParamEntityParsing and
|
|
|
|
|
GetInputContext of Parser objects are available with 1.95.x
|
|
|
|
|
only. Parser objects now provide the ordered_attributes and
|
|
|
|
|
specified_attributes attributes. A new module expat.model was added,
|
|
|
|
|
which offers a number of additional constants if 1.95.x is used.
|
|
|
|
|
|
|
|
|
|
- xml.dom offers the new functions registerDOMImplementation and
|
|
|
|
|
getDOMImplementation.
|
|
|
|
|
|
|
|
|
|
- xml.dom.minidom offers a toprettyxml method. A number of DOM
|
|
|
|
|
conformance issues have been resolved. In particular, Element now
|
|
|
|
|
has an hasAttributes method, and the handling of namespaces was
|
|
|
|
|
improved.
|
|
|
|
|
|
2001-02-28 17:05:42 -04:00
|
|
|
|
- Ka-Ping Yee contributed two new modules: inspect.py, a module for
|
|
|
|
|
getting information about live Python code, and pydoc.py, a module
|
|
|
|
|
for interactively converting docstrings to HTML or text.
|
|
|
|
|
Tools/scripts/pydoc, which is now automatically installed into
|
2001-02-28 22:31:33 -04:00
|
|
|
|
<prefix>/bin, uses pydoc.py to display documentation; try running
|
2001-03-02 10:05:59 -04:00
|
|
|
|
"pydoc -h" for instructions. "pydoc -g" pops up a small GUI that
|
|
|
|
|
lets you browse the module docstrings using a web browser.
|
2001-02-28 17:05:42 -04:00
|
|
|
|
|
2001-02-28 22:31:33 -04:00
|
|
|
|
- New library module difflib.py, primarily packaging the SequenceMatcher
|
|
|
|
|
class at the heart of the popular ndiff.py file-comparison tool.
|
|
|
|
|
|
|
|
|
|
- doctest.py (a framework for verifying Python code examples in docstrings)
|
|
|
|
|
is now part of the std library.
|
|
|
|
|
|
2001-02-03 23:09:53 -04:00
|
|
|
|
Windows changes
|
|
|
|
|
|
2001-03-02 10:05:59 -04:00
|
|
|
|
- A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a
|
|
|
|
|
small GUI that lets you browse the module docstrings using your
|
|
|
|
|
default web browser.
|
|
|
|
|
|
2001-02-28 22:31:33 -04:00
|
|
|
|
- Import is now case-sensitive. PEP 235 (Import on Case-Insensitive
|
|
|
|
|
Platforms) is implemented. See
|
|
|
|
|
|
|
|
|
|
http://python.sourceforge.net/peps/pep-0235.html
|
|
|
|
|
|
|
|
|
|
for full details, especially the "Current Lower-Left Semantics" section.
|
|
|
|
|
The new Windows import rules are simpler than before:
|
|
|
|
|
|
|
|
|
|
A. If the PYTHONCASEOK environment variable exists, same as
|
|
|
|
|
before: silently accept the first case-insensitive match of any
|
|
|
|
|
kind; raise ImportError if none found.
|
|
|
|
|
|
|
|
|
|
B. Else search sys.path for the first case-sensitive match; raise
|
|
|
|
|
ImportError if none found.
|
|
|
|
|
|
|
|
|
|
The same rules have been implented on other platforms with case-
|
|
|
|
|
insensitive but case-preserving filesystems too (including Cygwin, and
|
|
|
|
|
several flavors of Macintosh operating systems).
|
2001-02-03 23:09:53 -04:00
|
|
|
|
|
2001-02-19 03:06:36 -04:00
|
|
|
|
- winsound module: Under Win9x, winsound.Beep() now attempts to simulate
|
|
|
|
|
what it's supposed to do (and does do under NT and 2000) via direct
|
|
|
|
|
port manipulation. It's unknown whether this will work on all systems,
|
2001-02-28 22:31:33 -04:00
|
|
|
|
but it does work on my Win98SE systems now and was known to be useless on
|
2001-02-19 03:06:36 -04:00
|
|
|
|
all Win9x systems before.
|
|
|
|
|
|
2001-02-28 22:31:33 -04:00
|
|
|
|
- Build: Subproject _test (effectively) renamed to _testcapi.
|
|
|
|
|
|
2001-03-01 18:19:38 -04:00
|
|
|
|
New platforms
|
|
|
|
|
|
|
|
|
|
- 2.1 should compile and run out of the box under MacOS X, even using HFS+.
|
|
|
|
|
Thanks to Steven Majewski!
|
|
|
|
|
|
|
|
|
|
- 2.1 should compile and run out of the box on Cygwin. Thanks to Jason
|
|
|
|
|
Tishler!
|
|
|
|
|
|
2001-03-02 02:49:50 -04:00
|
|
|
|
- 2.1 contains new files and patches for RISCOS, thanks to Dietmar
|
|
|
|
|
Schwertberger! See RISCOS/README for more information -- it seems
|
|
|
|
|
that because of the bizarre filename conventions on RISCOS, no port
|
2001-10-24 17:51:44 -03:00
|
|
|
|
to that platform is easy.
|
2001-03-02 02:49:50 -04:00
|
|
|
|
|
2001-02-19 03:06:36 -04:00
|
|
|
|
|
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-02-22 11:53:21 -04:00
|
|
|
|
- Removed the obsolete soundex module.
|
|
|
|
|
|
2001-02-27 00:21:58 -04:00
|
|
|
|
- xml.dom.minidom now uses the standard DOM exceptions. Node supports
|
|
|
|
|
the isSameNode method; NamedNodeMap the get method.
|
|
|
|
|
|
|
|
|
|
- xml.sax.expatreader supports the lexical handler property; it
|
|
|
|
|
generates comment, startCDATA, and endCDATA events.
|
|
|
|
|
|
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 17:24:51 -04:00
|
|
|
|
- Build: New subproject _symtable, for new DLL _symtable.pyd (a nascent
|
|
|
|
|
interface to some Python compiler internals).
|
|
|
|
|
|
|
|
|
|
- Build: Subproject ucnhash is gone, since the code was folded into the
|
2001-02-02 01:57:15 -04:00
|
|
|
|
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-02-18 04:48:49 -04:00
|
|
|
|
- The outcome of comparing non-numeric objects of different types is
|
2001-02-18 04:28:33 -04:00
|
|
|
|
not defined by the language, other than that it's arbitrary but
|
|
|
|
|
consistent (see the Reference Manual). An implementation detail changed
|
|
|
|
|
in 2.1a1 such that None now compares less than any other object. Code
|
|
|
|
|
relying on this new behavior (like code that relied on the previous
|
|
|
|
|
behavior) does so at its own risk.
|
|
|
|
|
|
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:
|
|
|
|
|
|
2001-02-03 11:06:40 -04:00
|
|
|
|
1) "from M import X" now works even if (after loading module M)
|
|
|
|
|
sys.modules['M'] is not a real module; it's basically a getattr()
|
|
|
|
|
operation with AttributeError exceptions changed into ImportError.
|
2001-01-12 12:25:08 -04:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2001-02-04 18:37:56 -04:00
|
|
|
|
import imp,sys,string
|
|
|
|
|
magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
|
|
|
|
|
reg = ':pyc:M::%s::%s:' % (magic, sys.executable)
|
|
|
|
|
open("/proc/sys/fs/binfmt_misc/register","wb").write(reg)
|
2001-01-04 16:30:56 -04:00
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
2001-02-27 00:21:58 -04:00
|
|
|
|
- The pyexpat module supports a number of new handlers, which are
|
|
|
|
|
available only in expat 1.2. If invocation of a callback fails, it
|
|
|
|
|
will report an additional frame in the traceback. Parser objects
|
|
|
|
|
participate now in garbage collection. If expat reports an unknown
|
|
|
|
|
encoding, pyexpat will try to use a Python codec; that works only
|
|
|
|
|
for single-byte charsets. The parser type objects is exposed as
|
|
|
|
|
XMLParserObject.
|
|
|
|
|
|
|
|
|
|
- xml.dom now offers standard definitions for symbolic node type and
|
|
|
|
|
exception code constants, and a hierarchy of DOM exceptions. minidom
|
|
|
|
|
was adjusted to use them.
|
|
|
|
|
|
|
|
|
|
- The conformance of xml.dom.minidom to the DOM specification was
|
|
|
|
|
improved. It detects a number of additional error cases; the
|
|
|
|
|
previous/next relationship works even when the tree is modified;
|
|
|
|
|
Node supports the normalize() method; NamedNodeMap, DocumentType and
|
|
|
|
|
DOMImplementation classes were added; Element supports the
|
|
|
|
|
hasAttribute and hasAttributeNS methods; and Text supports the splitText
|
|
|
|
|
method.
|
|
|
|
|
|
2001-01-10 16:13:55 -04:00
|
|
|
|
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
|
|
|
|
|
|
2001-04-15 23:05:23 -03:00
|
|
|
|
- socket module: the OpenSSL code now adds support for RAND_status()
|
|
|
|
|
and EGD (Entropy Gathering Device).
|
|
|
|
|
|
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
|
|
|
|
======================================================================
|