summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
committerGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
commit99a247fd01c1cd780c0c3ee1116657627f1ee744 (patch)
tree319e33cb6612c3fafb2eb82e15c5e85e3d771e4f /Doc/whatsnew
parent1628eaa5dc8892ff381ca7558cc7c8d80fac494d (diff)
parent8ed677db129171317b8ee7cd45b39b9013f5a2d6 (diff)
downloadcpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.zip
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.gz
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.bz2
Merge with main repo default branch.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.3.rst114
1 files changed, 98 insertions, 16 deletions
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index b0e3885..a674dd6 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -66,6 +66,7 @@ New library modules:
* :mod:`faulthandler` (helps debugging low-level crashes)
* :mod:`ipaddress` (high-level objects representing IP addresses and masks)
* :mod:`lzma` (compress data using the XZ / LZMA algorithm)
+* :mod:`unittest.mock` (replace parts of your system under test with mock objects)
* :mod:`venv` (Python :ref:`virtual environments <pep-405>`, as in the
popular ``virtualenv`` package)
@@ -560,6 +561,41 @@ which considerably simplifies writing decorators and any code that validates
or amends calling signatures or arguments.
+PEP 421: Adding sys.implementation
+==================================
+
+:pep:`421` - Adding sys.implementation
+ PEP written and implemented by Eric Snow.
+
+A new attribute on the :mod:`sys` module exposes details specific to the
+implementation of the currently running interpreter. The initial set of
+attributes on :attr:`sys.implementation` are ``name``, ``version``,
+``hexversion``, and ``cache_tag``.
+
+The intention of ``sys.implementation`` is to consolidate into one namespace
+the implementation-specific data used by the standard library. This allows
+different Python implementations to share a single standard library code base
+much more easily. In its initial state, ``sys.implementation`` holds only a
+small portion of the implementation-specific data. Over time that ratio will
+shift in order to make the standard library more portable.
+
+One example of improved standard library portability is ``cache_tag``. As of
+Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` to
+support :pep:`3147` compliance. Any Python implementation that uses
+``importlib`` for its built-in import system may use ``cache_tag`` to control
+the caching behavior for modules.
+
+SimpleNamespace
+---------------
+
+The implementation of ``sys.implementation`` also introduces a new type to
+Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based
+namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like
+:class:`object`. However, unlike ``object``, ``SimpleNamespace`` instances
+are writable. This means that you can add, remove, and modify the namespace
+through normal attribute access.
+
+
.. _importlib:
Using importlib as the Implementation of Import
@@ -815,6 +851,8 @@ Some smaller changes made to the core Python language are:
(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.
@@ -885,7 +923,7 @@ New Modules
faulthandler
------------
-This new debug module contains functions to dump Python tracebacks explicitly,
+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
@@ -1044,7 +1082,7 @@ collections classes. Aliases for ABCs are still present in the
contextlib
----------
-:class:`~collections.ExitStack` now provides a solid foundation for
+: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
@@ -1084,7 +1122,7 @@ datetime
--------
* Equality comparisons between naive and aware :class:`~datetime.datetime`
- instances don't raise :exc:`TypeError`.
+ 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
@@ -1193,13 +1231,18 @@ API changes
ftplib
------
-The :class:`~ftplib.FTP_TLS` class now provides a new
-:func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to
-plaintext. This can be useful to take advantage of firewalls that know how to
-handle NAT with non-secure FTP without opening fixed ports.
+* The :class:`~ftplib.FTP_TLS` class now provides a new
+ :func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to
+ plaintext. This can be useful to take advantage of firewalls that know how to
+ handle NAT with non-secure FTP without opening fixed ports.
+
+ (Contributed by Giampaolo Rodolà in :issue:`12139`)
-(Contributed by Giampaolo Rodolà in :issue:`12139`)
+* Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory
+ listing format and deprecates :meth:`ftplib.FTP.nlst` and
+ :meth:`ftplib.FTP.dir`.
+ (Contributed by Giampaolo Rodolà in :issue:`11072`)
gc
--
@@ -1217,6 +1260,31 @@ side channel attacks on digests through timing analysis.
(Contributed by Nick Coghlan and Christian Heimes in issue:`15061`)
+html.entities
+-------------
+
+A new :data:`~html.entities.html5` dictionary that maps HTML5 named character
+references to the equivalent Unicode character(s) (e.g. ``html5['gt;'] == '>'``)
+has been added to the :mod:`html.entities` module. The dictionary is now also
+used by :class:`~html.parser.HTMLParser`.
+
+(Contributed by Ezio Melotti in :issue:`11113` and :issue:`15156`)
+
+
+html.parser
+-----------
+
+:class:`~html.parser.HTMLParser` is now able to parse broken markup without
+raising errors, therefore the *strict* argument of the constructor and the
+:exc:`~html.parser.HTMLParseError` exception are now deprecated.
+The ability to parse broken markup is the result of a number of bug fixes that
+are also available on the latest bug fix releases of Python 2.7/3.2.
+
+(Contributed by Ezio Melotti in :issue:`15114`, and :issue:`14538`,
+:issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`,
+:issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`,
+:issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`)
+
imaplib
-------
@@ -1659,6 +1727,16 @@ The new functions `types.new_class` and `types.prepare_class` provide support
for PEP 3115 compliant dynamic type creation. (:issue:`14588`)
+unittest
+--------
+
+:meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, and
+:meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used as
+context managers.
+
+(Contributed by Ezio Melotti and Winston Ewert in :issue:`10775`)
+
+
urllib
------
@@ -1792,6 +1870,15 @@ Deprecated Python modules, functions and methods
* :class:`abc.abstractstaticmethod` has been deprecated, use
:class:`staticmethod` with :func:`abc.abstractmethod` instead.
+* :mod:`importlib` package:
+
+ * :meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour of
+ :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store
+ both the modification time and size of the source file the bytecode file was
+ compiled from.
+
+
+
Deprecated functions and types of the C API
@@ -1900,7 +1987,7 @@ Porting Python code
updated to use the full name of the module instead of just the tail of the
name.
-* The **index** argument to :func:`__import__` now defaults to 0 instead of -1
+* The *index* argument to :func:`__import__` now defaults to 0 instead of -1
and no longer support negative values. It was an oversight when :pep:`328` was
implemented that the default value remained -1. If you need to continue to
perform a relative import followed by an absolute import, then perform the
@@ -1923,11 +2010,6 @@ Porting Python code
:attr:`sys.path_importer_cache` where it repesents the use of implicit
finders, but semantically it should not change anything.
-* :meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour of
- :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store
- both the modification time and size of the source file the bytecode file was
- compiled from.
-
* :class:`importlib.abc.Finder` no longer specifies a `find_module()` abstract
method that must be implemented. If you were relying on subclasses to
implement that method, make sure to check for the method's existence first.
@@ -1968,9 +2050,9 @@ Porting C code
* :c:func:`PyImport_GetMagicNumber` now returns -1 upon failure.
-* As a negative value for the **level** argument to :func:`__import__` is no
+* As a negative value for the *level* argument to :func:`__import__` is no
longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`.
- This also means that the value of **level** used by
+ This also means that the value of *level* used by
:c:func:`PyImport_ImportModuleEx` is now 0 instead of -1.