* Multi-dimensional comparisons are supported for any array type.
* One-dimensional memoryviews of hashable (read-only) types with formats B,
- b or c are now hashable. (Contributed by Antoine Pitrou in :issue:`13411`)
+ b or c are now hashable. (Contributed by Antoine Pitrou in :issue:`13411`.)
* Arbitrary slicing of any 1-D arrays type is supported. For example, it
is now possible to reverse a memoryview in O(1) by using a negative step.
* For further changes see `Build and C API Changes`_ and `Porting C code`_.
-(Contributed by Stefan Krah in :issue:`10181`)
+(Contributed by Stefan Krah in :issue:`10181`.)
.. seealso::
Python version when a more recent version is installed).
In addition to the launcher, the Windows installer now includes an
-option to add the newly installed Python to the system PATH (contributed
-by Brian Curtin in :issue:`3561`).
+option to add the newly installed Python to the system PATH. (Contributed
+by Brian Curtin in :issue:`3561`.)
.. seealso::
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`)
+ (Contributed by Ezio Melotti in :issue:`12753`.)
* Unicode database updated to UCD version 6.1.0
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`)
+ (Contributed by Petri Lehtinen in :issue:`12170`.)
* The ``rjust()``, ``ljust()``, and ``center()`` methods of :class:`bytes`
and :class:`bytearray` now accept a :class:`bytearray` for the ``fill``
* 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`)
+ (:issue:`4966`).
New Modules
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`)
+(Contributed by Google and Peter Moody in :pep:`3144`.)
lzma
----
using the LZMA algorithm, including support for the ``.xz`` and ``.lzma``
file formats.
-(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`)
+(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)
Improved Modules
* :class:`abc.abstractstaticmethod` has been deprecated, use
:class:`staticmethod` with :func:`abc.abstractmethod` instead.
-(Contributed by Darren Dale in :issue:`11610`)
+(Contributed by Darren Dale in :issue:`11610`.)
:meth:`abc.ABCMeta.register` now returns the registered subclass, which means
it can now be used as a class decorator (:issue:`10868`).
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`)
+(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)
base64
* :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`)
+ (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`)
+ (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.
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`)
+: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
push a wide character so the next :meth:`~curses.window.get_wch` will return
it
-(Contributed by Iñigo Serna in :issue:`6755`)
+(Contributed by Iñigo Serna in :issue:`6755`.)
datetime
--------
: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`)
+ 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`)
+ :meth:`ftplib.FTP.dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)
functools
A new :func:`~hmac.compare_digest` function has been added to prevent side
channel attacks on digests through timing analysis. (Contributed by Nick
-Coghlan and Christian Heimes in :issue:`15061`)
+Coghlan and Christian Heimes in :issue:`15061`.)
http
(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`)
+:issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)
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`)
+Melotti in :issue:`11113` and :issue:`15156`.)
imaplib
The :class:`~imaplib.IMAP4_SSL` constructor now accepts an SSLContext
parameter to control parameters of the secure channel.
-(Contributed by Sijin Joseph in :issue:`8808`)
+(Contributed by Sijin Joseph in :issue:`8808`.)
inspect
where those names were resolved, making it easier to verify correct internal
state when testing code that relies on stateful closures.
-(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`)
+(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`.)
A new :func:`~inspect.getgeneratorlocals` function has been added. This
function reports the current binding of local variables in the generator's
stack frame, making it easier to verify correct internal state when testing
generators.
-(Contributed by Meador Inge in :issue:`15153`)
+(Contributed by Meador Inge in :issue:`15153`.)
io
--
exclusively create a new file, and raise a :exc:`FileExistsError` if the file
already exists. It is based on the C11 'x' mode to fopen().
-(Contributed by David Townshend in :issue:`12760`)
+(Contributed by David Townshend in :issue:`12760`.)
The constructor of the :class:`~io.TextIOWrapper` class has a new
*write_through* optional argument. If *write_through* is ``True``, calls to
The :mod:`math` module has a new function, :func:`~math.log2`, which returns
the base-2 logarithm of *x*.
-(Written by Mark Dickinson in :issue:`11888`).
+(Written by Mark Dickinson in :issue:`11888`.)
mmap
('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')
>>>
-(Contributed by Giampaolo Rodolà in :issue:`9795`)
+(Contributed by Giampaolo Rodolà in :issue:`9795`.)
os
set to False makes the method execute the scheduled events due to expire
soonest (if any) and then return immediately.
This is useful in case you want to use the :class:`~sched.scheduler` in
- non-blocking applications. (Contributed by Giampaolo Rodolà in :issue:`13449`)
+ non-blocking applications. (Contributed by Giampaolo Rodolà in :issue:`13449`.)
* :class:`~sched.scheduler` class can now be safely used in multi-threaded
environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in
- :issue:`8684`)
+ :issue:`8684`.)
* *timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class
constructor are now optional and defaults to :func:`time.time` and
:func:`time.sleep` respectively. (Contributed by Chris Clark in
- :issue:`13245`)
+ :issue:`13245`.)
* :meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs`
*argument* parameter is now optional. (Contributed by Chris Clark in
- :issue:`13245`)
+ :issue:`13245`.)
* :meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs`
now accept a *kwargs* parameter. (Contributed by Chris Clark in
- :issue:`13245`)
+ :issue:`13245`.)
select
* New functions:
* :func:`~shutil.disk_usage`: provides total, used and free disk space
- statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`)
+ statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`.)
* :func:`~shutil.chown`: allows one to change user and/or group of the given
path also specifying the user/group names and not only their numeric
- ids. (Contributed by Sandro Tosi in :issue:`12191`)
+ ids. (Contributed by Sandro Tosi in :issue:`12191`.)
* :func:`shutil.get_terminal_size`: returns the size of the terminal window
to which the interpreter is attached. (Contributed by Zbigniew
Jędrzejewski-Szmek in :issue:`13609`.)
* :func:`~shutil.rmtree` is now resistant to symlink attacks on platforms
which support the new ``dir_fd`` parameter in :func:`os.open` and
- :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack
+ :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack
in :issue:`4489`.)
The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP.starttls`
method now accept an SSLContext parameter to control parameters of the secure
-channel. (Contributed by Kasun Herath in :issue:`8809`)
+channel. (Contributed by Kasun Herath in :issue:`8809`.)
socket
(http://en.wikipedia.org/wiki/Socketcan), on Linux
(http://lwn.net/Articles/253425).
- (Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:`10141`)
+ (Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:`10141`.)
* The :class:`~socket.socket` class now supports the PF_RDS protocol family
(http://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and
pseudo-random bytes.
* :func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes.
- (Contributed by Victor Stinner in :issue:`12049`)
+ (Contributed by Victor Stinner in :issue:`12049`.)
* The :mod:`ssl` module now exposes a finer-grained exception hierarchy
in order to make it easier to inspect the various kinds of errors.
- (Contributed by Antoine Pitrou in :issue:`11183`)
+ (Contributed by Antoine Pitrou in :issue:`11183`.)
* :meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument
to be used if the private key is encrypted.
- (Contributed by Adam Simpkins in :issue:`12803`)
+ (Contributed by Adam Simpkins in :issue:`12803`.)
* Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is
now supported through the :meth:`~ssl.SSLContext.load_dh_params` and
:meth:`~ssl.SSLContext.set_ecdh_curve` methods.
- (Contributed by Antoine Pitrou in :issue:`13626` and :issue:`13627`)
+ (Contributed by Antoine Pitrou in :issue:`13626` and :issue:`13627`.)
* SSL sockets have a new :meth:`~ssl.SSLSocket.get_channel_binding` method
allowing the implementation of certain authentication mechanisms such as
- SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`)
+ SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`.)
* You can query the SSL compression algorithm used by an SSL socket, thanks
to its new :meth:`~ssl.SSLSocket.compression` method. The new attribute
:attr:`~ssl.OP_NO_COMPRESSION` can be used to disable compression.
- (Contributed by Antoine Pitrou in :issue:`13634`)
+ (Contributed by Antoine Pitrou in :issue:`13634`.)
* Support has been added for the Next Procotol Negotiation extension using
the :meth:`ssl.SSLContext.set_npn_protocols` method.
- (Contributed by Colin Marc in :issue:`14204`)
+ (Contributed by Colin Marc in :issue:`14204`.)
* SSL errors can now be introspected more easily thanks to
:attr:`~ssl.SSLError.library` and :attr:`~ssl.SSLError.reason` attributes.
- (Contributed by Antoine Pitrou in :issue:`14837`)
+ (Contributed by Antoine Pitrou in :issue:`14837`.)
* The :func:`~ssl.get_server_certificate` function now supports IPv6.
(Contributed by Charles-François Natali in :issue:`11811`.)
:func:`stat.filemode`. It can be used to convert a file's mode to a string of
the form '-rwxrwxrwx'.
-(Contributed by Giampaolo Rodolà in :issue:`14807`)
+(Contributed by Giampaolo Rodolà in :issue:`14807`.)
struct
:class:`threading.Condition`, :class:`threading.Semaphore`,
:class:`threading.BoundedSemaphore`, :class:`threading.Event`, and
:class:`threading.Timer`, all of which used to be factory functions returning a
-class instance, are now classes and may be subclassed. (Contributed by Éric
-Araujo in :issue:`10968`).
+class instance, are now classes and may be subclassed. (Contributed by Éric
+Araujo in :issue:`10968`.)
The :class:`threading.Thread` constructor now accepts a ``daemon`` keyword
argument to override the default behavior of inheriting the ``deamon`` flag
* :func:`~time.clock_getres`, :func:`~time.clock_gettime` and
:func:`~time.clock_settime` functions with ``CLOCK_xxx`` constants.
- (Contributed by Victor Stinner in :issue:`10278`)
+ (Contributed by Victor Stinner in :issue:`10278`.)
To improve cross platform consistency, :func:`~time.sleep` now raises a
:exc:`ValueError` when passed a negative sleep value. Previously this was an
: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`)
+:issue:`10775`.)
:meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult`
object.
and the generic launchers :program:`xdg-open`, from the FreeDesktop.org
project, and :program:`gvfs-open`, which is the default URI handler for GNOME
3. (The former contributed by Arnaud Calmettes in :issue:`13620`, the latter
-by Matthias Klose in :issue:`14493`)
+by Matthias Klose in :issue:`14493`.)
xml.etree.ElementTree
* UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x faster.
- (contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and
+ (Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and
:issue:`15026`.)
* It's helpful to add the bug/patch number as a comment:
The :ref:`~socket.transmogrify()` function was added to the
- :mod:`socket` module. (Contributed by P.Y. Developer in :issue:`12345`.)
+ :mod:`socket` module. (Contributed by P.Y. Developer in :issue:`12345`.)
This saves the maintainer the effort of going through the Mercurial log
when researching a change.
in :ref:`binary-transforms` and :ref:`text-transforms`.
(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`,
-:issue:`17828` and :issue:`19619`)
+:issue:`17828` and :issue:`19619`.)
.. _whatsnew-pep-451:
* Module ``__file__`` attributes (and related values) should now always
contain absolute paths by default, with the sole exception of
``__main__.__file__`` when a script has been executed directly using
- a relative path (Contributed by Brett Cannon in :issue:`18416`).
+ a relative path. (Contributed by Brett Cannon in :issue:`18416`.)
* All the UTF-\* codecs (except UTF-7) now reject surrogates during both
encoding and decoding unless the ``surrogatepass`` error handler is used,
with the exception of the UTF-16 decoder (which accepts valid surrogate pairs)
and the UTF-16 encoder (which produces them while encoding non-BMP characters).
- Contributed by Victor Stinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in
- :issue:`12892`.
+ (Contributed by Victor Stinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in
+ :issue:`12892`.)
* New German EBCDIC :ref:`codec <standard-encodings>` ``cp273``. (Contributed
by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.)
in :issue:`12866`.)
New :func:`~audioop.byteswap` function converts big-endian samples to
-little-endian and vice versa (Contributed by Serhiy Storchaka in
-:issue:`19641`).
+little-endian and vice versa. (Contributed by Serhiy Storchaka in
+:issue:`19641`.)
All :mod:`audioop` functions now accept any :term:`bytes-like object`. Strings
are not accepted: they didn't work before, now they raise an error right away.
The new :class:`contextlib.suppress` context manager helps to clarify the
intent of code that deliberately suppresses exceptions from a single
-statement. (Contributed by Raymond Hettinger in :issue:`15806` and
-Zero Piraeus in :issue:`19266`)
+statement. (Contributed by Raymond Hettinger in :issue:`15806` and
+Zero Piraeus in :issue:`19266`.)
The new :func:`contextlib.redirect_stdout` context manager makes it easier
for utility scripts to handle inflexible APIs that write their output to
from a function that was written to implement a command line interface.
It is recommended only for utility scripts because it affects the
global state of :data:`sys.stdout`. (Contributed by Raymond Hettinger
-in :issue:`15805`)
+in :issue:`15805`.)
The :mod:`contextlib` documentation has also been updated to include a
:ref:`discussion <single-use-reusable-and-reentrant-cms>` of the
to ``distb(tb)``).
(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:`11816`
-and Claudiu Popa in :issue:`17916`)
+and Claudiu Popa in :issue:`17916`.)
New function :func:`~dis.stack_effect` computes the effect on the Python stack
of a given opcode and argument, information that is not otherwise available.
for normal callables. The new descriptor also makes it easier to get
arbitrary callables (including :func:`~functools.partial` instances)
to behave like normal instance methods when included in a class definition.
-(Contributed by Alon Horev and Nick Coghlan in :issue:`4331`)
+(Contributed by Alon Horev and Nick Coghlan in :issue:`4331`.)
.. _whatsnew-singledispatch:
A new :func:`hashlib.pbkdf2_hmac` function provides
the `PKCS#5 password-based key derivation function 2
<http://en.wikipedia.org/wiki/PBKDF2>`_. (Contributed by Christian
-Heimes in :issue:`18582`)
+Heimes in :issue:`18582`.)
The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is now
a formally supported interface. It has always existed in CPython's
New function :func:`~html.unescape` function converts HTML5 character references to
the corresponding Unicode characters. (Contributed by Ezio Melotti in
-:issue:`2927`)
+:issue:`2927`.)
:class:`~html.parser.HTMLParser` accepts a new keyword argument
*convert_charrefs* that, when ``True``, automatically converts all character
references. For backward-compatibility, its value defaults to ``False``, but
it will change to ``True`` in a future version of Python, so you are invited to
set it explicitly and update your code to use this new feature. (Contributed
-by Ezio Melotti in :issue:`13633`)
+by Ezio Melotti in :issue:`13633`.)
The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated.
-(Contributed by Ezio Melotti in :issue:`15114`)
+(Contributed by Ezio Melotti in :issue:`15114`.)
http
The :mod:`inspect` module now offers a basic :ref:`command line interface
<inspect-module-cli>` to quickly display source code and other
-information for modules, classes and functions. (Contributed by Claudiu Popa
-and Nick Coghlan in :issue:`18626`)
+information for modules, classes and functions. (Contributed by Claudiu Popa
+and Nick Coghlan in :issue:`18626`.)
:func:`~inspect.unwrap` makes it easy to unravel wrapper function chains
created by :func:`functools.wraps` (and any other API that sets the
-``__wrapped__`` attribute on a wrapper function). (Contributed by
-Daniel Urban, Aaron Iles and Nick Coghlan in :issue:`13266`)
+``__wrapped__`` attribute on a wrapper function). (Contributed by
+Daniel Urban, Aaron Iles and Nick Coghlan in :issue:`13266`.)
As part of the implementation of the new :mod:`enum` module, the
:mod:`inspect` module now has substantially better support for custom
``__dir__`` methods and dynamic class attributes provided through
-metaclasses (Contributed by Ethan Furman in :issue:`18929` and
-:issue:`19030`)
+metaclasses. (Contributed by Ethan Furman in :issue:`18929` and
+:issue:`19030`.)
:func:`~inspect.getfullargspec` and :func:`~inspect.getargspec`
now use the :func:`~inspect.signature` API. This allows them to
attributes, and report the already bound first argument for bound methods,
so it is still necessary to update your code to use
:func:`~inspect.signature` directly if those features are desired.
-(Contributed by Yury Selivanov in :issue:`17481`)
+(Contributed by Yury Selivanov in :issue:`17481`.)
:func:`~inspect.signature` now supports duck types of CPython functions,
-which adds support for functions compiled with Cython. (Contributed
-by Stefan Behnel and Yury Selivanov in :issue:`17159`)
+which adds support for functions compiled with Cython. (Contributed
+by Stefan Behnel and Yury Selivanov in :issue:`17159`.)
ipaddress
Logging configuration data received from a socket via the
:func:`logging.config.listen` function can now be validated before being
processed by supplying a verification function as the argument to the new
-*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)
+*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)
.. _whatsnew-marshal-3:
:func:`~multiprocessing.get_all_start_methods` reports all start methods
available on the platform, :func:`~multiprocessing.get_start_method` reports
the current start method, and :func:`~multiprocessing.set_start_method` sets
-the start method. (Contributed by Richard Oudkerk in :issue:`8713`).
+the start method. (Contributed by Richard Oudkerk in :issue:`8713`.)
:mod:`multiprocessing` also now has the concept of a ``context``, which
determines how child processes are created. New function
when using the ``spawn`` or ``forkserver`` start methods. This resolves some
edge cases where combining multiprocessing, the ``-m`` command line switch,
and explicit relative imports could cause obscure failures in child
-processes. (Contributed by Nick Coghlan in :issue:`19946`)
+processes. (Contributed by Nick Coghlan in :issue:`19946`.)
operator
Windows). (Contributed by Brian Curtin in :issue:`11939`.)
:func:`os.path.ismount` now recognizes volumes mounted below a drive
-root on Windows. (Contributed by Tim Golden in :issue:`9035`.)
+root on Windows. (Contributed by Tim Golden in :issue:`9035`.)
:func:`os.open` supports two new flags on platforms that provide them,
:data:`~os.O_PATH` (un-opened file descriptor), and :data:`~os.O_TMPFILE`
functions. (The older API is now deprecated.) In addition to the already
supported XML plist format (:data:`~plistlib.FMT_XML`), it also now supports
the binary plist format (:data:`~plistlib.FMT_BINARY`). (Contributed by Ronald
-Oussoren and others in :issue:`14455`).
+Oussoren and others in :issue:`14455`.)
poplib
(Contributed by Serhiy Storchaka in :issue:`19132`.)
Long strings are now wrapped using Python's normal line continuation
-syntax. (Contributed by Antoine Pitrou in :issue:`17150`).
+syntax. (Contributed by Antoine Pitrou in :issue:`17150`.)
pty
The :mod:`pydoc` module is now based directly on the :func:`inspect.signature`
introspection API, allowing it to provide signature information for a wider
variety of callable objects. This change also means that ``__wrapped__``
-attributes are now taken into account when displaying help information
-(Contributed by Larry Hastings in :issue:`19674`)
+attributes are now taken into account when displaying help information.
+(Contributed by Larry Hastings in :issue:`19674`.)
The :mod:`pydoc` module no longer displays the ``self`` parameter for
already bound methods. Instead, it aims to always display the exact current
-signature of the supplied callable (Contributed by Larry Hastings in
-:issue:`20710`)
+signature of the supplied callable. (Contributed by Larry Hastings in
+:issue:`20710`.)
In addition to the changes that have been made to :mod:`pydoc` directly,
its handling of custom ``__dir__`` methods and various descriptor
:exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which allows
both socket level errors and SMTP protocol level errors to be caught in one
try/except statement by code that only cares whether or not an error occurred.
-(Contributed by Ned Jackson Lovely in :issue:`2118`).
+(Contributed by Ned Jackson Lovely in :issue:`2118`.)
socket
:data:`~ssl.PROTOCOL_TLSv1_1` and :data:`~ssl.PROTOCOL_TLSv1_2` (TLSv1.1 and
TLSv1.2 support) have been added; support for these protocols is only available if
Python is linked with OpenSSL 1.0.1 or later. (Contributed by Michele Orrù and
-Antoine Pitrou in :issue:`16692`)
+Antoine Pitrou in :issue:`16692`.)
.. _whatsnew34-sslcontext:
A new :func:`traceback.clear_frames` function takes a traceback object
and clears the local variables in all of the frames it references,
reducing the amount of memory consumed. (Contributed by Andrew Kuchling in
-:issue:`1565525`).
+:issue:`1565525`.)
types
The http method that will be used by a :class:`~urllib.request.Request` class
can now be specified by setting a :class:`~urllib.request.Request.method`
-class attribute on the subclass. (Contributed by Jason R Coombs in
+class attribute on the subclass. (Contributed by Jason R Coombs in
:issue:`18978`.)
:class:`~urllib.request.Request` objects are now reusable: if the
:issue:`17015`.)
:func:`~mock.mock_open` objects now have ``readline`` and ``readlines``
-methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)
+methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)
venv
----
:mod:`venv` now includes activation scripts for the ``csh`` and ``fish``
-shells (Contributed by Andrew Svetlov in :issue:`15417`.)
+shells. (Contributed by Andrew Svetlov in :issue:`15417`.)
:class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function
take a new keyword argument *with_pip*, which defaults to ``False``, that
-------
New :class:`~weakref.WeakMethod` class simulates weak references to bound
-methods. (Contributed by Antoine Pitrou in :issue:`14631`.)
+methods. (Contributed by Antoine Pitrou in :issue:`14631`.)
New :class:`~weakref.finalize` class makes it possible to register a callback
to be invoked when an object is garbage collected, without needing to
-carefully manage the lifecycle of the weak reference itself. (Contributed by
-Richard Oudkerk in :issue:`15528`)
+carefully manage the lifecycle of the weak reference itself. (Contributed by
+Richard Oudkerk in :issue:`15528`.)
The callback, if any, associated with a :class:`~weakref.ref` is now
exposed via the :attr:`~weakref.ref.__callback__` attribute. (Contributed
* The new :c:func:`PyType_GetSlot` function has been added to the stable ABI,
allowing retrieval of function pointers from named type slots when using
- the limited API. (Contributed by Martin von Löwis in :issue:`17162`)
+ the limited API. (Contributed by Martin von Löwis in :issue:`17162`.)
* The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API
allows applications embedding the CPython interpreter to reliably force
- a particular encoding and error handler for the standard streams
- (Contributed by Bastien Montagne and Nick Coghlan in :issue:`16129`)
+ a particular encoding and error handler for the standard streams.
+ (Contributed by Bastien Montagne and Nick Coghlan in :issue:`16129`.)
* Most Python C APIs that don't mutate string arguments are now correctly
- marked as accepting ``const char *`` rather than ``char *`` (Contributed
- by Serhiy Storchaka in :issue:`1772673`).
+ marked as accepting ``const char *`` rather than ``char *``. (Contributed
+ by Serhiy Storchaka in :issue:`1772673`.)
* A new shell version of ``python-config`` can be used even when a python
interpreter is not available (for example, in cross compilation scenarios).
* The ``-R`` option to the :ref:`python regression test suite <regrtest>` now
also checks for memory allocation leaks, using
:func:`sys.getallocatedblocks()`. (Contributed by Antoine Pitrou in
- :issue:`13390`).
+ :issue:`13390`.)
* ``python -m`` now works with namespace packages.
longer imported by default. The marshal module has been improved to load
compiled Python code faster. (Contributed by Antoine Pitrou, Christian
Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:`19209`,
- :issue:`19205` and :issue:`9548`)
+ :issue:`19205` and :issue:`9548`.)
* :class:`bz2.BZ2File` is now as fast or faster than the Python2 version for
most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed by
Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)
* :func:`random.getrandbits` is 20%-40% faster for small integers (the most
- common use case). (Contributed by Serhiy Storchaka in :issue:`16674`).
+ common use case). (Contributed by Serhiy Storchaka in :issue:`16674`.)
* By taking advantage of the new storage format for strings, pickling of
strings is now significantly faster. (Contributed by Victor Stinner and
* :func:`os.urandom` now uses a lazily-opened persistent file descriptor
so as to avoid using many file descriptors when run in parallel from
- multiple threads. (Contributed by Antoine Pitrou in :issue:`18756`.)
+ multiple threads. (Contributed by Antoine Pitrou in :issue:`18756`.)
.. _deprecated-3.4:
* The [X refs, Y blocks] output of a debug (``--with-pydebug``) build of the
CPython interpreter is now off by default. It can be re-enabled using the
- ``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.)
+ ``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.)
* The python command and most stdlib scripts (as well as :mod:`argparse`) now
output ``--version`` information to ``stdout`` instead of ``stderr`` (for
storage). (:issue:`17094`.)
* Parameter names in ``__annotations__`` dicts are now mangled properly,
- similarly to ``__kwdefaults__``. (Contributed by Yury Selivanov in
- :issue:`20625`).
+ similarly to ``__kwdefaults__``. (Contributed by Yury Selivanov in
+ :issue:`20625`.)
* :attr:`hashlib.hash.name` now always returns the identifier in lower case.
Previously some builtin hashes had uppercase names, but now that it is a