[Python-checkins] cpython (3.3): Move discussion of email changes into Improved Modules section.
r.david.murray
python-checkins at python.org
Sat Sep 29 21:44:26 CEST 2012
http://hg.python.org/cpython/rev/c3d90fb70247
changeset: 79283:c3d90fb70247
branch: 3.3
parent: 79280:b31da14ec12f
user: R David Murray <rdmurray at bitdance.com>
date: Sat Sep 29 15:43:33 2012 -0400
summary:
Move discussion of email changes into Improved Modules section.
files:
Doc/whatsnew/3.3.rst | 784 +++++++++++++++---------------
1 files changed, 392 insertions(+), 392 deletions(-)
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -687,11 +687,399 @@
in the `Porting Python code`_ section of this document.
-New Email Package Features
-==========================
+Other Language Changes
+======================
+
+Some smaller changes made to the core Python language are:
+
+* Added support for Unicode name aliases and named sequences.
+ Both :func:`unicodedata.lookup()` and ``'\N{...}'`` now resolve name aliases,
+ and :func:`unicodedata.lookup()` resolves named sequences too.
+
+ (Contributed by Ezio Melotti in :issue:`12753`)
+
+* Unicode database updated to UCD version 6.1.0
+
+* Equality comparisons on :func:`range` objects now return a result reflecting
+ the equality of the underlying sequences generated by those range objects.
+
+ (:issue:`13201`)
+
+* The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()``
+ methods of :class:`bytes` and :class:`bytearray` objects now accept an
+ integer between 0 and 255 as their first argument.
+
+ (Contributed by Petri Lehtinen in :issue:`12170`)
+
+* New methods have been added to :class:`list` and :class:`bytearray`:
+ ``copy()`` and ``clear()``.
+
+ (:issue:`10516`)
+
+* Raw bytes literals can now be written ``rb"..."`` as well as ``br"..."``.
+ (Contributed by Antoine Pitrou in :issue:`13748`.)
+
+* :meth:`dict.setdefault` now does only one lookup for the given key, making
+ it atomic when used with built-in types.
+ (Contributed by Filip Gruszczyński in :issue:`13521`.)
+
+
+.. XXX mention new error messages for passing wrong number of arguments to functions
+
+
+A Finer-Grained Import Lock
+===========================
+
+Previous versions of CPython have always relied on a global import lock.
+This led to unexpected annoyances, such as deadlocks when importing a module
+would trigger code execution in a different thread as a side-effect.
+Clumsy workarounds were sometimes employed, such as the
+:c:func:`PyImport_ImportModuleNoBlock` C API function.
+
+In Python 3.3, importing a module takes a per-module lock. This correctly
+serializes importation of a given module from multiple threads (preventing
+the exposure of incompletely initialized modules), while eliminating the
+aforementioned annoyances.
+
+(contributed by Antoine Pitrou in :issue:`9260`.)
+
+
+Builtin functions and types
+===========================
+
+* :func:`open` gets a new *opener* parameter: the underlying file descriptor
+ for the file object is then obtained by calling *opener* with (*file*,
+ *flags*). It can be used to use custom flags like :data:`os.O_CLOEXEC` for
+ example. The ``'x'`` mode was added: open for exclusive creation, failing if
+ the file already exists.
+* :func:`print`: added the *flush* keyword argument. If the *flush* keyword
+ argument is true, the stream is forcibly flushed.
+* :func:`hash`: hash randomization is enabled by default, see
+ :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`.
+* The :class:`str` type gets a new :meth:`~str.casefold` method: return a
+ casefolded copy of the string, casefolded strings may be used for caseless
+ matching. For example, ``'ß'.casefold()`` returns ``'ss'``.
+* The sequence documentation has been substantially rewritten to better
+ explain the binary/text sequence distinction and to provide specific
+ documentation sections for the individual builtin sequence types
+ (:issue:`4966`)
+
+New Modules
+===========
+
+faulthandler
+------------
+
+This new debug module :mod:`faulthandler` contains functions to dump Python tracebacks explicitly,
+on a fault (a crash like a segmentation fault), after a timeout, or on a user
+signal. Call :func:`faulthandler.enable` to install fault handlers for the
+:const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, and
+:const:`SIGILL` signals. You can also enable them at startup by setting the
+:envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-X`
+``faulthandler`` command line option.
+
+Example of a segmentation fault on Linux: ::
+
+ $ python -q -X faulthandler
+ >>> import ctypes
+ >>> ctypes.string_at(0)
+ Fatal Python error: Segmentation fault
+
+ Current thread 0x00007fb899f39700:
+ File "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at
+ File "<stdin>", line 1 in <module>
+ Segmentation fault
+
+
+ipaddress
+---------
+
+The new :mod:`ipaddress` module provides tools for creating and manipulating
+objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e.
+an IP address associated with a specific IP subnet).
+
+(Contributed by Google and Peter Moody in :pep:`3144`)
+
+lzma
+----
+
+The newly-added :mod:`lzma` module provides data compression and decompression
+using the LZMA algorithm, including support for the ``.xz`` and ``.lzma``
+file formats.
+
+(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`)
+
+
+Improved Modules
+================
+
+abc
+---
+
+Improved support for abstract base classes containing descriptors composed with
+abstract methods. The recommended approach to declaring abstract descriptors is
+now to provide :attr:`__isabstractmethod__` as a dynamically updated
+property. The built-in descriptors have been updated accordingly.
+
+ * :class:`abc.abstractproperty` has been deprecated, use :class:`property`
+ with :func:`abc.abstractmethod` instead.
+ * :class:`abc.abstractclassmethod` has been deprecated, use
+ :class:`classmethod` with :func:`abc.abstractmethod` instead.
+ * :class:`abc.abstractstaticmethod` has been deprecated, use
+ :class:`staticmethod` with :func:`abc.abstractmethod` instead.
+
+(Contributed by Darren Dale in :issue:`11610`)
+
+array
+-----
+
+The :mod:`array` module supports the :c:type:`long long` type using ``q`` and
+``Q`` type codes.
+
+(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`)
+
+
+base64, binascii
+----------------
+
+ASCII-only Unicode strings are now accepted by the decoding functions of the
+modern interface. For example, ``base64.b64decode('YWJj')`` returns ``b'abc'``.
+
+
+bz2
+---
+
+The :mod:`bz2` module has been rewritten from scratch. In the process, several
+new features have been added:
+
+* New :func:`bz2.open` function: open a bzip2-compressed file in binary or
+ text mode.
+
+* :class:`bz2.BZ2File` can now read from and write to arbitrary file-like
+ objects, by means of its constructor's *fileobj* argument.
+
+ (Contributed by Nadeem Vawda in :issue:`5863`)
+
+* :class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress
+ multi-stream inputs (such as those produced by the :program:`pbzip2` tool).
+ :class:`bz2.BZ2File` can now also be used to create this type of file, using
+ the ``'a'`` (append) mode.
+
+ (Contributed by Nir Aides in :issue:`1625`)
+
+* :class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` API,
+ except for the :meth:`detach` and :meth:`truncate` methods.
+
+
+codecs
+------
+
+The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly
+``replace`` and ``ignore`` error handlers on all Windows versions. The
+:mod:`~encodings.mbcs` codec now supports all error handlers, instead of only
+``replace`` to encode and ``ignore`` to decode.
+
+A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is the
+Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it is used
+by ``sys.stdout`` if the console output code page is set to cp65001 (e.g., using
+``chcp 65001`` command).
+
+Multibyte CJK decoders now resynchronize faster. They only ignore the first
+byte of an invalid byte sequence. For example, ``b'\xff\n'.decode('gb2312',
+'replace')`` now returns a ``\n`` after the replacement character.
+
+(:issue:`12016`)
+
+Incremental CJK codec encoders are no longer reset at each call to their
+encode() methods. For example::
+
+ $ ./python -q
+ >>> import codecs
+ >>> encoder = codecs.getincrementalencoder('hz')('strict')
+ >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.')
+ b'~{NpJ)l6HK!#~} Bye.'
+
+This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older Python
+versions.
+
+(:issue:`12100`)
+
+The ``unicode_internal`` codec has been deprecated.
+
+
+collections
+-----------
+
+Addition of a new :class:`~collections.ChainMap` class to allow treating a
+number of mappings as a single unit.
+
+(Written by Raymond Hettinger for :issue:`11089`, made public in
+:issue:`11297`)
+
+The abstract base classes have been moved in a new :mod:`collections.abc`
+module, to better differentiate between the abstract and the concrete
+collections classes. Aliases for ABCs are still present in the
+:mod:`collections` module to preserve existing imports.
+
+(:issue:`11085`)
+
+.. XXX addition of __slots__ to ABCs not recorded here: internal detail
+
+
+contextlib
+----------
+
+:class:`~contextlib.ExitStack` now provides a solid foundation for
+programmatic manipulation of context managers and similar cleanup
+functionality. Unlike the previous ``contextlib.nested`` API (which was
+deprecated and removed), the new API is designed to work correctly
+regardless of whether context managers acquire their resources in
+their ``__init__`` method (for example, file objects) or in their
+``__enter__`` method (for example, synchronisation objects from the
+:mod:`threading` module).
+
+(:issue:`13585`)
+
+
+crypt
+-----
+
+Addition of salt and modular crypt format (hashing method) and the :func:`~crypt.mksalt`
+function to the :mod:`crypt` module.
+
+(:issue:`10924`)
+
+curses
+------
+
+ * If the :mod:`curses` module is linked to the ncursesw library, use Unicode
+ functions when Unicode strings or characters are passed (e.g.
+ :c:func:`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`).
+ * Use the locale encoding instead of ``utf-8`` to encode Unicode strings.
+ * :class:`curses.window` has a new :attr:`curses.window.encoding` attribute.
+ * The :class:`curses.window` class has a new :meth:`~curses.window.get_wch`
+ method to get a wide character
+ * The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to
+ push a wide character so the next :meth:`~curses.window.get_wch` will return
+ it
+
+(Contributed by Iñigo Serna in :issue:`6755`)
+
+datetime
+--------
+
+ * Equality comparisons between naive and aware :class:`~datetime.datetime`
+ instances now return :const:`False` instead of raising :exc:`TypeError`.
+ * New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp
+ corresponding to the :class:`~datetime.datetime` instance.
+ * The :meth:`datetime.datetime.strftime` method supports formatting years
+ older than 1000.
+ * The :meth:`datetime.datetime.astimezone` method can now be
+ called without arguments to convert datetime instance to the system
+ timezone.
+
+decimal
+-------
+
+:issue:`7652` - integrate fast native decimal arithmetic.
+ C-module and libmpdec written by Stefan Krah.
+
+The new C version of the decimal module integrates the high speed libmpdec
+library for arbitrary precision correctly-rounded decimal floating point
+arithmetic. libmpdec conforms to IBM's General Decimal Arithmetic Specification.
+
+Performance gains range from 10x for database applications to 100x for
+numerically intensive applications. These numbers are expected gains
+for standard precisions used in decimal floating point arithmetic. Since
+the precision is user configurable, the exact figures may vary. For example,
+in integer bignum arithmetic the differences can be significantly higher.
+
+The following table is meant as an illustration. Benchmarks are available
+at http://www.bytereef.org/mpdecimal/quickstart.html.
+
+ +---------+-------------+--------------+-------------+
+ | | decimal.py | _decimal | speedup |
+ +=========+=============+==============+=============+
+ | pi | 42.02s | 0.345s | 120x |
+ +---------+-------------+--------------+-------------+
+ | telco | 172.19s | 5.68s | 30x |
+ +---------+-------------+--------------+-------------+
+ | psycopg | 3.57s | 0.29s | 12x |
+ +---------+-------------+--------------+-------------+
+
+Features
+~~~~~~~~
+
+* The :exc:`~decimal.FloatOperation` signal optionally enables stricter
+ semantics for mixing floats and Decimals.
+
+* If Python is compiled without threads, the C version automatically
+ disables the expensive thread local context machinery. In this case,
+ the variable :data:`~decimal.HAVE_THREADS` is set to False.
+
+API changes
+~~~~~~~~~~~
+
+* The C module has the following context limits, depending on the machine
+ architecture:
+
+ +-------------------+---------------------+------------------------------+
+ | | 32-bit | 64-bit |
+ +===================+=====================+==============================+
+ | :const:`MAX_PREC` | :const:`425000000` | :const:`999999999999999999` |
+ +-------------------+---------------------+------------------------------+
+ | :const:`MAX_EMAX` | :const:`425000000` | :const:`999999999999999999` |
+ +-------------------+---------------------+------------------------------+
+ | :const:`MIN_EMIN` | :const:`-425000000` | :const:`-999999999999999999` |
+ +-------------------+---------------------+------------------------------+
+
+* In the context templates (:class:`~decimal.DefaultContext`,
+ :class:`~decimal.BasicContext` and :class:`~decimal.ExtendedContext`)
+ the magnitude of :attr:`~decimal.Context.Emax` and
+ :attr:`~decimal.Context.Emin` has changed to :const:`999999`.
+
+* The :class:`~decimal.Decimal` constructor in decimal.py does not observe
+ the context limits and converts values with arbitrary exponents or precision
+ exactly. Since the C version has internal limits, the following scheme is
+ used: If possible, values are converted exactly, otherwise
+ :exc:`~decimal.InvalidOperation` is raised and the result is NaN. In the
+ latter case it is always possible to use :meth:`~decimal.Context.create_decimal`
+ in order to obtain a rounded or inexact value.
+
+
+* The power function in decimal.py is always correctly-rounded. In the
+ C version, it is defined in terms of the correctly-rounded
+ :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` functions,
+ but the final result is only "almost always correctly rounded".
+
+
+* In the C version, the context dictionary containing the signals is a
+ :class:`~collections.abc.MutableMapping`. For speed reasons,
+ :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` always
+ refer to the same :class:`~collections.abc.MutableMapping` that the context
+ was initialized with. If a new signal dictionary is assigned,
+ :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps`
+ are updated with the new values, but they do not reference the RHS
+ dictionary.
+
+
+* Pickling a :class:`~decimal.Context` produces a different output in order
+ to have a common interchange format for the Python and C versions.
+
+
+* The order of arguments in the :class:`~decimal.Context` constructor has been
+ changed to match the order displayed by :func:`repr`.
+
+
+* The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method
+ is deprecated.
+
+
+email
+-----
Policy Framework
-----------------
+~~~~~~~~~~~~~~~~
The email package now has a :mod:`~email.policy` framework. A
:class:`~email.policy.Policy` is an object with several methods and properties
@@ -746,7 +1134,7 @@
Provisional Policy with New Header API
---------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While the policy framework is worthwhile all by itself, the main motivation for
introducing it is to allow the creation of new policies that implement new
@@ -838,394 +1226,6 @@
standard Content Transfer Encodings.
-Other Language Changes
-======================
-
-Some smaller changes made to the core Python language are:
-
-* Added support for Unicode name aliases and named sequences.
- Both :func:`unicodedata.lookup()` and ``'\N{...}'`` now resolve name aliases,
- and :func:`unicodedata.lookup()` resolves named sequences too.
-
- (Contributed by Ezio Melotti in :issue:`12753`)
-
-* Unicode database updated to UCD version 6.1.0
-
-* Equality comparisons on :func:`range` objects now return a result reflecting
- the equality of the underlying sequences generated by those range objects.
-
- (:issue:`13201`)
-
-* The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()``
- methods of :class:`bytes` and :class:`bytearray` objects now accept an
- integer between 0 and 255 as their first argument.
-
- (Contributed by Petri Lehtinen in :issue:`12170`)
-
-* New methods have been added to :class:`list` and :class:`bytearray`:
- ``copy()`` and ``clear()``.
-
- (:issue:`10516`)
-
-* Raw bytes literals can now be written ``rb"..."`` as well as ``br"..."``.
- (Contributed by Antoine Pitrou in :issue:`13748`.)
-
-* :meth:`dict.setdefault` now does only one lookup for the given key, making
- it atomic when used with built-in types.
- (Contributed by Filip Gruszczyński in :issue:`13521`.)
-
-
-.. XXX mention new error messages for passing wrong number of arguments to functions
-
-
-A Finer-Grained Import Lock
-===========================
-
-Previous versions of CPython have always relied on a global import lock.
-This led to unexpected annoyances, such as deadlocks when importing a module
-would trigger code execution in a different thread as a side-effect.
-Clumsy workarounds were sometimes employed, such as the
-:c:func:`PyImport_ImportModuleNoBlock` C API function.
-
-In Python 3.3, importing a module takes a per-module lock. This correctly
-serializes importation of a given module from multiple threads (preventing
-the exposure of incompletely initialized modules), while eliminating the
-aforementioned annoyances.
-
-(contributed by Antoine Pitrou in :issue:`9260`.)
-
-
-Builtin functions and types
-===========================
-
-* :func:`open` gets a new *opener* parameter: the underlying file descriptor
- for the file object is then obtained by calling *opener* with (*file*,
- *flags*). It can be used to use custom flags like :data:`os.O_CLOEXEC` for
- example. The ``'x'`` mode was added: open for exclusive creation, failing if
- the file already exists.
-* :func:`print`: added the *flush* keyword argument. If the *flush* keyword
- argument is true, the stream is forcibly flushed.
-* :func:`hash`: hash randomization is enabled by default, see
- :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`.
-* The :class:`str` type gets a new :meth:`~str.casefold` method: return a
- casefolded copy of the string, casefolded strings may be used for caseless
- matching. For example, ``'ß'.casefold()`` returns ``'ss'``.
-* The sequence documentation has been substantially rewritten to better
- explain the binary/text sequence distinction and to provide specific
- documentation sections for the individual builtin sequence types
- (:issue:`4966`)
-
-New Modules
-===========
-
-faulthandler
-------------
-
-This new debug module :mod:`faulthandler` contains functions to dump Python tracebacks explicitly,
-on a fault (a crash like a segmentation fault), after a timeout, or on a user
-signal. Call :func:`faulthandler.enable` to install fault handlers for the
-:const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, and
-:const:`SIGILL` signals. You can also enable them at startup by setting the
-:envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-X`
-``faulthandler`` command line option.
-
-Example of a segmentation fault on Linux: ::
-
- $ python -q -X faulthandler
- >>> import ctypes
- >>> ctypes.string_at(0)
- Fatal Python error: Segmentation fault
-
- Current thread 0x00007fb899f39700:
- File "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at
- File "<stdin>", line 1 in <module>
- Segmentation fault
-
-
-ipaddress
----------
-
-The new :mod:`ipaddress` module provides tools for creating and manipulating
-objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e.
-an IP address associated with a specific IP subnet).
-
-(Contributed by Google and Peter Moody in :pep:`3144`)
-
-lzma
-----
-
-The newly-added :mod:`lzma` module provides data compression and decompression
-using the LZMA algorithm, including support for the ``.xz`` and ``.lzma``
-file formats.
-
-(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`)
-
-
-Improved Modules
-================
-
-abc
----
-
-Improved support for abstract base classes containing descriptors composed with
-abstract methods. The recommended approach to declaring abstract descriptors is
-now to provide :attr:`__isabstractmethod__` as a dynamically updated
-property. The built-in descriptors have been updated accordingly.
-
- * :class:`abc.abstractproperty` has been deprecated, use :class:`property`
- with :func:`abc.abstractmethod` instead.
- * :class:`abc.abstractclassmethod` has been deprecated, use
- :class:`classmethod` with :func:`abc.abstractmethod` instead.
- * :class:`abc.abstractstaticmethod` has been deprecated, use
- :class:`staticmethod` with :func:`abc.abstractmethod` instead.
-
-(Contributed by Darren Dale in :issue:`11610`)
-
-array
------
-
-The :mod:`array` module supports the :c:type:`long long` type using ``q`` and
-``Q`` type codes.
-
-(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`)
-
-
-base64, binascii
-----------------
-
-ASCII-only Unicode strings are now accepted by the decoding functions of the
-modern interface. For example, ``base64.b64decode('YWJj')`` returns ``b'abc'``.
-
-
-bz2
----
-
-The :mod:`bz2` module has been rewritten from scratch. In the process, several
-new features have been added:
-
-* New :func:`bz2.open` function: open a bzip2-compressed file in binary or
- text mode.
-
-* :class:`bz2.BZ2File` can now read from and write to arbitrary file-like
- objects, by means of its constructor's *fileobj* argument.
-
- (Contributed by Nadeem Vawda in :issue:`5863`)
-
-* :class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress
- multi-stream inputs (such as those produced by the :program:`pbzip2` tool).
- :class:`bz2.BZ2File` can now also be used to create this type of file, using
- the ``'a'`` (append) mode.
-
- (Contributed by Nir Aides in :issue:`1625`)
-
-* :class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` API,
- except for the :meth:`detach` and :meth:`truncate` methods.
-
-
-codecs
-------
-
-The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly
-``replace`` and ``ignore`` error handlers on all Windows versions. The
-:mod:`~encodings.mbcs` codec now supports all error handlers, instead of only
-``replace`` to encode and ``ignore`` to decode.
-
-A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is the
-Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it is used
-by ``sys.stdout`` if the console output code page is set to cp65001 (e.g., using
-``chcp 65001`` command).
-
-Multibyte CJK decoders now resynchronize faster. They only ignore the first
-byte of an invalid byte sequence. For example, ``b'\xff\n'.decode('gb2312',
-'replace')`` now returns a ``\n`` after the replacement character.
-
-(:issue:`12016`)
-
-Incremental CJK codec encoders are no longer reset at each call to their
-encode() methods. For example::
-
- $ ./python -q
- >>> import codecs
- >>> encoder = codecs.getincrementalencoder('hz')('strict')
- >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.')
- b'~{NpJ)l6HK!#~} Bye.'
-
-This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older Python
-versions.
-
-(:issue:`12100`)
-
-The ``unicode_internal`` codec has been deprecated.
-
-
-collections
------------
-
-Addition of a new :class:`~collections.ChainMap` class to allow treating a
-number of mappings as a single unit.
-
-(Written by Raymond Hettinger for :issue:`11089`, made public in
-:issue:`11297`)
-
-The abstract base classes have been moved in a new :mod:`collections.abc`
-module, to better differentiate between the abstract and the concrete
-collections classes. Aliases for ABCs are still present in the
-:mod:`collections` module to preserve existing imports.
-
-(:issue:`11085`)
-
-.. XXX addition of __slots__ to ABCs not recorded here: internal detail
-
-
-contextlib
-----------
-
-:class:`~contextlib.ExitStack` now provides a solid foundation for
-programmatic manipulation of context managers and similar cleanup
-functionality. Unlike the previous ``contextlib.nested`` API (which was
-deprecated and removed), the new API is designed to work correctly
-regardless of whether context managers acquire their resources in
-their ``__init__`` method (for example, file objects) or in their
-``__enter__`` method (for example, synchronisation objects from the
-:mod:`threading` module).
-
-(:issue:`13585`)
-
-
-crypt
------
-
-Addition of salt and modular crypt format (hashing method) and the :func:`~crypt.mksalt`
-function to the :mod:`crypt` module.
-
-(:issue:`10924`)
-
-curses
-------
-
- * If the :mod:`curses` module is linked to the ncursesw library, use Unicode
- functions when Unicode strings or characters are passed (e.g.
- :c:func:`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`).
- * Use the locale encoding instead of ``utf-8`` to encode Unicode strings.
- * :class:`curses.window` has a new :attr:`curses.window.encoding` attribute.
- * The :class:`curses.window` class has a new :meth:`~curses.window.get_wch`
- method to get a wide character
- * The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to
- push a wide character so the next :meth:`~curses.window.get_wch` will return
- it
-
-(Contributed by Iñigo Serna in :issue:`6755`)
-
-datetime
---------
-
- * Equality comparisons between naive and aware :class:`~datetime.datetime`
- instances now return :const:`False` instead of raising :exc:`TypeError`.
- * New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp
- corresponding to the :class:`~datetime.datetime` instance.
- * The :meth:`datetime.datetime.strftime` method supports formatting years
- older than 1000.
- * The :meth:`datetime.datetime.astimezone` method can now be
- called without arguments to convert datetime instance to the system
- timezone.
-
-decimal
--------
-
-:issue:`7652` - integrate fast native decimal arithmetic.
- C-module and libmpdec written by Stefan Krah.
-
-The new C version of the decimal module integrates the high speed libmpdec
-library for arbitrary precision correctly-rounded decimal floating point
-arithmetic. libmpdec conforms to IBM's General Decimal Arithmetic Specification.
-
-Performance gains range from 10x for database applications to 100x for
-numerically intensive applications. These numbers are expected gains
-for standard precisions used in decimal floating point arithmetic. Since
-the precision is user configurable, the exact figures may vary. For example,
-in integer bignum arithmetic the differences can be significantly higher.
-
-The following table is meant as an illustration. Benchmarks are available
-at http://www.bytereef.org/mpdecimal/quickstart.html.
-
- +---------+-------------+--------------+-------------+
- | | decimal.py | _decimal | speedup |
- +=========+=============+==============+=============+
- | pi | 42.02s | 0.345s | 120x |
- +---------+-------------+--------------+-------------+
- | telco | 172.19s | 5.68s | 30x |
- +---------+-------------+--------------+-------------+
- | psycopg | 3.57s | 0.29s | 12x |
- +---------+-------------+--------------+-------------+
-
-Features
-~~~~~~~~
-
-* The :exc:`~decimal.FloatOperation` signal optionally enables stricter
- semantics for mixing floats and Decimals.
-
-* If Python is compiled without threads, the C version automatically
- disables the expensive thread local context machinery. In this case,
- the variable :data:`~decimal.HAVE_THREADS` is set to False.
-
-API changes
-~~~~~~~~~~~
-
-* The C module has the following context limits, depending on the machine
- architecture:
-
- +-------------------+---------------------+------------------------------+
- | | 32-bit | 64-bit |
- +===================+=====================+==============================+
- | :const:`MAX_PREC` | :const:`425000000` | :const:`999999999999999999` |
- +-------------------+---------------------+------------------------------+
- | :const:`MAX_EMAX` | :const:`425000000` | :const:`999999999999999999` |
- +-------------------+---------------------+------------------------------+
- | :const:`MIN_EMIN` | :const:`-425000000` | :const:`-999999999999999999` |
- +-------------------+---------------------+------------------------------+
-
-* In the context templates (:class:`~decimal.DefaultContext`,
- :class:`~decimal.BasicContext` and :class:`~decimal.ExtendedContext`)
- the magnitude of :attr:`~decimal.Context.Emax` and
- :attr:`~decimal.Context.Emin` has changed to :const:`999999`.
-
-* The :class:`~decimal.Decimal` constructor in decimal.py does not observe
- the context limits and converts values with arbitrary exponents or precision
- exactly. Since the C version has internal limits, the following scheme is
- used: If possible, values are converted exactly, otherwise
- :exc:`~decimal.InvalidOperation` is raised and the result is NaN. In the
- latter case it is always possible to use :meth:`~decimal.Context.create_decimal`
- in order to obtain a rounded or inexact value.
-
-
-* The power function in decimal.py is always correctly-rounded. In the
- C version, it is defined in terms of the correctly-rounded
- :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` functions,
- but the final result is only "almost always correctly rounded".
-
-
-* In the C version, the context dictionary containing the signals is a
- :class:`~collections.abc.MutableMapping`. For speed reasons,
- :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` always
- refer to the same :class:`~collections.abc.MutableMapping` that the context
- was initialized with. If a new signal dictionary is assigned,
- :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps`
- are updated with the new values, but they do not reference the RHS
- dictionary.
-
-
-* Pickling a :class:`~decimal.Context` produces a different output in order
- to have a common interchange format for the Python and C versions.
-
-
-* The order of arguments in the :class:`~decimal.Context` constructor has been
- changed to match the order displayed by :func:`repr`.
-
-
-* The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method
- is deprecated.
-
-
ftplib
------
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list