Commit e41e4db2 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

Add various items

parent c0de8bb6
...@@ -554,6 +554,10 @@ changes, or look through the Subversion logs for all the details. ...@@ -554,6 +554,10 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Maru Newby after a suggestion by (Contributed by Maru Newby after a suggestion by
Senthil Kumaran; :issue:`5142`.) Senthil Kumaran; :issue:`5142`.)
* The :mod:`binascii` module now supports the buffer API, so it can be
used with :class:`memoryview` instances and other similar buffer objects.
(Backported from 3.x by Florent Xicluna; :issue:`7703`.)
* The :mod:`bz2` module's :class:`BZ2File` now supports the context * The :mod:`bz2` module's :class:`BZ2File` now supports the context
management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``. management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``.
(Contributed by Hagen Fuerstenau; :issue:`3860`.) (Contributed by Hagen Fuerstenau; :issue:`3860`.)
...@@ -682,6 +686,11 @@ changes, or look through the Subversion logs for all the details. ...@@ -682,6 +686,11 @@ changes, or look through the Subversion logs for all the details.
supports buffering, resulting in much faster reading of HTTP responses. supports buffering, resulting in much faster reading of HTTP responses.
(Contributed by Kristjan Valur Jonsson; :issue:`4879`.) (Contributed by Kristjan Valur Jonsson; :issue:`4879`.)
The :class:`HTTPConnection` and :class:`HTTPSConnection` classes
now support a *source_address* parameter, a ``(host, port)`` 2-tuple
giving the source address that will be used for the connection.
(Contributed by Eldon Ziegler; :issue:`3972`.)
* The :mod:`imaplib` module now supports IPv6 addresses. * The :mod:`imaplib` module now supports IPv6 addresses.
(Contributed by Derek Morr; :issue:`1655`.) (Contributed by Derek Morr; :issue:`1655`.)
...@@ -882,9 +891,22 @@ changes, or look through the Subversion logs for all the details. ...@@ -882,9 +891,22 @@ changes, or look through the Subversion logs for all the details.
a timeout was provided and the operation timed out. a timeout was provided and the operation timed out.
(Contributed by Tim Lesher; :issue:`1674032`.) (Contributed by Tim Lesher; :issue:`1674032`.)
* The Unicode database provided by the :mod:`unicodedata` module
remains at version 5.1.0, but Python now uses it internally to
determine which characters are numeric, whitespace, or represent
line breaks. The database also now includes information from the
:file:`Unihan.txt` data file. (Patch by Anders Chrigström
and Amaury Forgeot d'Arc; :issue:`1571184`.)
* The :class:`UserDict` class is now a new-style class. (Changed by * The :class:`UserDict` class is now a new-style class. (Changed by
Benjamin Peterson.) Benjamin Peterson.)
* The ElementTree library, :mod:`xml.etree`, no longer escapes
ampersands and angle brackets when outputting an XML processing
instruction (which looks like `<?xml-stylesheet href="#style1"?>`)
or comment (which looks like `<!-- comment -->`).
(Patch by Neil Muller; :issue:`2746`.)
* The :mod:`zipfile` module's :class:`ZipFile` now supports the context * The :mod:`zipfile` module's :class:`ZipFile` now supports the context
management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``. management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``.
(Contributed by Brian Curtin; :issue:`5511`.) (Contributed by Brian Curtin; :issue:`5511`.)
...@@ -899,6 +921,12 @@ changes, or look through the Subversion logs for all the details. ...@@ -899,6 +921,12 @@ changes, or look through the Subversion logs for all the details.
accepts a file object, in addition to the path names accepted in earlier accepts a file object, in addition to the path names accepted in earlier
versions. (Contributed by Gabriel Genellina; :issue:`4756`.) versions. (Contributed by Gabriel Genellina; :issue:`4756`.)
The :meth:`writestr` method now has an optional *compress_type* parameter
that lets you override the default compression method specified in the
:class:`ZipFile` constructor. (Contributed by Ronald Oussoren;
:issue:`6003`.)
New module: sysconfig New module: sysconfig
--------------------------------- ---------------------------------
...@@ -1019,7 +1047,8 @@ GvR worked on merging them into Python's version of :mod:`unittest`. ...@@ -1019,7 +1047,8 @@ GvR worked on merging them into Python's version of :mod:`unittest`.
* :meth:`assertMultiLineEqual` compares two strings, and if they're * :meth:`assertMultiLineEqual` compares two strings, and if they're
not equal, displays a helpful comparison that highlights the not equal, displays a helpful comparison that highlights the
differences in the two strings. differences in the two strings. This comparison is now used by
default when Unicode strings are compared with :meth:`assertEqual`.)
* :meth:`assertRegexpMatches` checks whether its first argument is a * :meth:`assertRegexpMatches` checks whether its first argument is a
string matching a regular expression provided as its second argument. string matching a regular expression provided as its second argument.
...@@ -1038,18 +1067,22 @@ GvR worked on merging them into Python's version of :mod:`unittest`. ...@@ -1038,18 +1067,22 @@ GvR worked on merging them into Python's version of :mod:`unittest`.
only reports the differences between the sets in case of error. only reports the differences between the sets in case of error.
* Similarly, :meth:`assertListEqual` and :meth:`assertTupleEqual` * Similarly, :meth:`assertListEqual` and :meth:`assertTupleEqual`
compare the specified types and explain the differences. compare the specified types and explain any differences without necessarily
printing their full values; these methods are now used by default
when comparing lists and tuples using :meth:`assertEqual`.
More generally, :meth:`assertSequenceEqual` compares two sequences More generally, :meth:`assertSequenceEqual` compares two sequences
and can optionally check whether both sequences are of a and can optionally check whether both sequences are of a
particular type. particular type.
* :meth:`assertDictEqual` compares two dictionaries and reports the * :meth:`assertDictEqual` compares two dictionaries and reports the
differences. :meth:`assertDictContainsSubset` checks whether differences; it's now used by default when you compare two dictionaries
using :meth:`assertEqual`. :meth:`assertDictContainsSubset` checks whether
all of the key/value pairs in *first* are found in *second*. all of the key/value pairs in *first* are found in *second*.
* :meth:`assertAlmostEqual` and :meth:`assertNotAlmostEqual` short-circuit * :meth:`assertAlmostEqual` and :meth:`assertNotAlmostEqual` test
(automatically pass or fail without checking decimal places) if the objects whether *first* and *second* are approximately equal by computing
are equal. their difference, rounding the result to an optionally-specified number
of *places* (the default is 7), and comparing to zero.
* :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of * :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of
the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.) the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)
...@@ -1361,6 +1394,14 @@ that may require changes to your code: ...@@ -1361,6 +1394,14 @@ that may require changes to your code:
nothing when a negative length is requested, as other file-like nothing when a negative length is requested, as other file-like
objects do. (:issue:`7348`). objects do. (:issue:`7348`).
In the standard library:
* The ElementTree library, :mod:`xml.etree`, no longer escapes
ampersands and angle brackets when outputting an XML processing
instruction (which looks like `<?xml-stylesheet href="#style1"?>`)
or comment (which looks like `<!-- comment -->`).
(Patch by Neil Muller; :issue:`2746`.)
For C extensions: For C extensions:
* C extensions that use integer format codes with the ``PyArg_Parse*`` * C extensions that use integer format codes with the ``PyArg_Parse*``
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment