Commit c545f1ce authored by Yury Selivanov's avatar Yury Selivanov

Merge 3.5

parents 977afe5a a88cd646
...@@ -86,14 +86,14 @@ Standard names are defined for the following types: ...@@ -86,14 +86,14 @@ Standard names are defined for the following types:
.. data:: GeneratorType .. data:: GeneratorType
The type of :term:`generator`-iterator objects, produced by calling a The type of :term:`generator`-iterator objects, created by
generator function. generator functions.
.. data:: CoroutineType .. data:: CoroutineType
The type of :term:`coroutine` objects, produced by calling a The type of :term:`coroutine` objects, created by
function defined with an :keyword:`async def` statement. :keyword:`async def` functions.
.. versionadded:: 3.5 .. versionadded:: 3.5
......
...@@ -178,7 +178,7 @@ Coroutine functions are declared using the new :keyword:`async def` syntax:: ...@@ -178,7 +178,7 @@ Coroutine functions are declared using the new :keyword:`async def` syntax::
>>> async def coro(): >>> async def coro():
... return 'spam' ... return 'spam'
Inside a coroutine function, a new :keyword:`await` expression can be used Inside a coroutine function, the new :keyword:`await` expression can be used
to suspend coroutine execution until the result is available. Any object to suspend coroutine execution until the result is available. Any object
can be *awaited*, as long as it implements the :term:`awaitable` protocol by can be *awaited*, as long as it implements the :term:`awaitable` protocol by
defining the :meth:`__await__` method. defining the :meth:`__await__` method.
...@@ -245,7 +245,7 @@ context managers:: ...@@ -245,7 +245,7 @@ context managers::
Note that both :keyword:`async for` and :keyword:`async with` can only Note that both :keyword:`async for` and :keyword:`async with` can only
be used inside a coroutine function declared with :keyword:`async def`. be used inside a coroutine function declared with :keyword:`async def`.
Coroutine functions are intended to be ran inside a compatible event loop, Coroutine functions are intended to be run inside a compatible event loop,
such as :class:`asyncio.Loop`. such as :class:`asyncio.Loop`.
.. seealso:: .. seealso::
...@@ -627,7 +627,7 @@ argparse ...@@ -627,7 +627,7 @@ argparse
The :class:`~argparse.ArgumentParser` class now allows to disable The :class:`~argparse.ArgumentParser` class now allows to disable
:ref:`abbreviated usage <prefix-matching>` of long options by setting :ref:`abbreviated usage <prefix-matching>` of long options by setting
:ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh,
Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.) Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)
...@@ -649,7 +649,7 @@ protocol. (Contributed by Berker Peksag in :issue:`20289`.) ...@@ -649,7 +649,7 @@ protocol. (Contributed by Berker Peksag in :issue:`20289`.)
cmath cmath
----- -----
A new function :func:`cmath.isclose` provides a way to test for approximate A new function :func:`~cmath.isclose` provides a way to test for approximate
equality. (Contributed by Chris Barker and Tal Einat in :issue:`24270`.) equality. (Contributed by Chris Barker and Tal Einat in :issue:`24270`.)
...@@ -695,7 +695,7 @@ collections.abc ...@@ -695,7 +695,7 @@ collections.abc
A new :class:`~collections.abc.Generator` abstract base class. (Contributed A new :class:`~collections.abc.Generator` abstract base class. (Contributed
by Stefan Behnel in :issue:`24018`.) by Stefan Behnel in :issue:`24018`.)
A new :class:`~collections.abc.Coroutine`, New :class:`~collections.abc.Coroutine`,
:class:`~collections.abc.AsyncIterator`, and :class:`~collections.abc.AsyncIterator`, and
:class:`~collections.abc.AsyncIterable` abstract base classes. :class:`~collections.abc.AsyncIterable` abstract base classes.
(Contributed by Yury Selivanov in :issue:`24184`.) (Contributed by Yury Selivanov in :issue:`24184`.)
...@@ -721,8 +721,8 @@ concurrent.futures ...@@ -721,8 +721,8 @@ concurrent.futures
------------------ ------------------
The :meth:`Executor.map <concurrent.futures.Executor.map>` method now accepts a The :meth:`Executor.map <concurrent.futures.Executor.map>` method now accepts a
*chunksize* argument to allow batching of tasks in child processes and improve *chunksize* argument to allow batching of tasks to improve performance when
performance of :meth:`~concurrent.futures.ProcessPoolExecutor`. :meth:`~concurrent.futures.ProcessPoolExecutor` is used.
(Contributed by Dan O'Reilly in :issue:`11271`.) (Contributed by Dan O'Reilly in :issue:`11271`.)
...@@ -739,28 +739,30 @@ don't provide any options to redirect it. (Contributed by Berker Peksag in ...@@ -739,28 +739,30 @@ don't provide any options to redirect it. (Contributed by Berker Peksag in
curses curses
------ ------
The new :func:`~curses.update_lines_cols` function updates the variables The new :func:`~curses.update_lines_cols` function updates :envvar:`LINES`
:data:`curses.LINES` and :data:`curses.COLS`. and :envvar:`COLS` environment variables. This is useful for detecting
manual screen resize. (Contributed by Arnon Yaari in :issue:`4254`.)
difflib difflib
------- -------
The charset of the HTML document generated by The charset of HTML documents generated by
:meth:`HtmlDiff.make_file <difflib.HtmlDiff.make_file>` :meth:`HtmlDiff.make_file <difflib.HtmlDiff.make_file>`
can now be customized by using *charset* keyword-only parameter. The default can now be customized by using a new *charset* keyword-only argument.
charset of HTML document changed from ``"ISO-8859-1"`` to ``"utf-8"``. The default charset of HTML document changed from ``"ISO-8859-1"``
to ``"utf-8"``.
(Contributed by Berker Peksag in :issue:`2052`.) (Contributed by Berker Peksag in :issue:`2052`.)
It is now possible to compare lists of byte strings with the The :func:`~difflib.diff_bytes` function can now compare lists of byte
:func:`~difflib.diff_bytes` function. This fixes a regression from Python 2. strings. This fixes a regression from Python 2.
(Contributed by Terry J. Reedy and Greg Ward in :issue:`17445`.) (Contributed by Terry J. Reedy and Greg Ward in :issue:`17445`.)
distutils distutils
--------- ---------
The ``build`` and ``build_ext`` commands now accept a ``-j`` option to Both ``build`` and ``build_ext`` commands now accept a ``-j`` option to
enable parallel building of extension modules. enable parallel building of extension modules.
(Contributed by Antoine Pitrou in :issue:`5309`.) (Contributed by Antoine Pitrou in :issue:`5309`.)
...@@ -792,17 +794,18 @@ method provides easy access to a canonical value for the ...@@ -792,17 +794,18 @@ method provides easy access to a canonical value for the
:mailheader:`Content-Disposition` header. :mailheader:`Content-Disposition` header.
(Contributed by Abhilash Raj in :issue:`21083`.) (Contributed by Abhilash Raj in :issue:`21083`.)
A new policy option :attr:`~email.policy.EmailPolicy.utf8` can be set A new policy option :attr:`EmailPolicy.utf8 <email.policy.EmailPolicy.utf8>`
to ``True`` to encode email headers using the UTF-8 charset instead of using can be set to ``True`` to encode email headers using the UTF-8 charset instead
encoded words. This allows ``Messages`` to be formatted according to of using encoded words. This allows ``Messages`` to be formatted according to
:rfc:`6532` and used with an SMTP server that supports the :rfc:`6531` :rfc:`6532` and used with an SMTP server that supports the :rfc:`6531`
``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:`24211`.) ``SMTPUTF8`` extension. (Contributed by R. David Murray in
:issue:`24211`.)
faulthandler faulthandler
------------ ------------
The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.enable`, :func:`~faulthandler.register`,
:func:`~faulthandler.dump_traceback` and :func:`~faulthandler.dump_traceback` and
:func:`~faulthandler.dump_traceback_later` functions now accept file :func:`~faulthandler.dump_traceback_later` functions now accept file
descriptors in addition to file-like objects. descriptors in addition to file-like objects.
...@@ -813,14 +816,14 @@ functools ...@@ -813,14 +816,14 @@ functools
--------- ---------
Most of :func:`~functools.lru_cache` machinery is now implemented in C, making Most of :func:`~functools.lru_cache` machinery is now implemented in C, making
it significantly faster. (Contributed by Matt Joiner, Alexey Kachayev, and it significantly faster. (Contributed by Matt Joiner, Alexey Kachayev, and
Serhiy Storchaka in :issue:`14373`.) Serhiy Storchaka in :issue:`14373`.)
glob glob
---- ----
The :func:`~glob.iglob` and :func:`~glob.glob` functions now support recursive :func:`~glob.iglob` and :func:`~glob.glob` functions now support recursive
search in subdirectories using the ``"**"`` pattern. search in subdirectories using the ``"**"`` pattern.
(Contributed by Serhiy Storchaka in :issue:`13968`.) (Contributed by Serhiy Storchaka in :issue:`13968`.)
...@@ -838,7 +841,7 @@ idlelib and IDLE ...@@ -838,7 +841,7 @@ idlelib and IDLE
---------------- ----------------
Since idlelib implements the IDLE shell and editor and is not intended for Since idlelib implements the IDLE shell and editor and is not intended for
import by other programs, it gets improvements with every release. See import by other programs, it gets improvements with every release. See
:file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0,
as well as changes made in future 3.5.x releases. This file is also available as well as changes made in future 3.5.x releases. This file is also available
from the IDLE Help -> About Idle dialog. from the IDLE Help -> About Idle dialog.
...@@ -888,17 +891,17 @@ object with code compiled from a string by running ...@@ -888,17 +891,17 @@ object with code compiled from a string by running
(Contributed by Brett Cannon in :issue:`21156`.) (Contributed by Brett Cannon in :issue:`21156`.)
The new :func:`util.module_from_spec <importlib.util.module_from_spec>` The new :func:`util.module_from_spec <importlib.util.module_from_spec>`
function is now the preferred way to create a new module. Compared to the function is now the preferred way to create a new module. As opposed to
:class:`types.ModuleType` class, this new function will set the various creating a :class:`types.ModuleType` instance directly, this new function
import-controlled attributes based on the passed-in spec object. will set the various import-controlled attributes based on the passed-in
(Contributed by Brett Cannon in :issue:`20383`.) spec object. (Contributed by Brett Cannon in :issue:`20383`.)
inspect inspect
------- -------
The :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes are now Both :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes are
picklable and hashable. (Contributed by Yury Selivanov in :issue:`20726` now picklable and hashable. (Contributed by Yury Selivanov in :issue:`20726`
and :issue:`20334`.) and :issue:`20334`.)
A new A new
...@@ -918,13 +921,13 @@ following of ``__wrapped__`` links. ...@@ -918,13 +921,13 @@ following of ``__wrapped__`` links.
A set of new functions to inspect A set of new functions to inspect
:term:`coroutine functions <coroutine function>` and :term:`coroutine functions <coroutine function>` and
``coroutine objects`` has been added: :term:`coroutine objects <coroutine>` has been added:
:func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`,
:func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`,
and :func:`~inspect.getcoroutinestate`. and :func:`~inspect.getcoroutinestate`.
(Contributed by Yury Selivanov in :issue:`24017` and :issue:`24400`.) (Contributed by Yury Selivanov in :issue:`24017` and :issue:`24400`.)
The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.stack`, :func:`~inspect.trace`,
:func:`~inspect.getouterframes`, and :func:`~inspect.getinnerframes` :func:`~inspect.getouterframes`, and :func:`~inspect.getinnerframes`
functions now return a list of named tuples. functions now return a list of named tuples.
(Contributed by Daniel Shahaf in :issue:`16808`.) (Contributed by Daniel Shahaf in :issue:`16808`.)
...@@ -933,7 +936,7 @@ functions now return a list of named tuples. ...@@ -933,7 +936,7 @@ functions now return a list of named tuples.
ipaddress ipaddress
--------- ---------
The :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes Both :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes
now accept an ``(address, netmask)`` tuple argument, so as to easily construct now accept an ``(address, netmask)`` tuple argument, so as to easily construct
network objects from existing addresses. (Contributed by Peter Moody network objects from existing addresses. (Contributed by Peter Moody
and Antoine Pitrou in :issue:`16531`.) and Antoine Pitrou in :issue:`16531`.)
...@@ -965,11 +968,11 @@ logging ...@@ -965,11 +968,11 @@ logging
All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`,
:meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`,
:meth:`~logging.Logger.debug`, etc.), now accept exception instances :meth:`~logging.Logger.debug`, etc.), now accept exception instances
in ``exc_info`` argument, in addition to boolean values and exception as an ``exc_info`` argument, in addition to boolean values and exception
tuples. (Contributed by Yury Selivanov in :issue:`20537`.) tuples. (Contributed by Yury Selivanov in :issue:`20537`.)
The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` classes now The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` class now
accepts an optional :class:`ssl.SSLContext` instance to configure the SSL accepts an optional :class:`ssl.SSLContext` instance to configure SSL
settings used in an HTTP connection. settings used in an HTTP connection.
(Contributed by Alex Gaynor in :issue:`22788`.) (Contributed by Alex Gaynor in :issue:`22788`.)
...@@ -983,7 +986,7 @@ lzma ...@@ -983,7 +986,7 @@ lzma
---- ----
The :meth:`LZMADecompressor.decompress <lzma.LZMADecompressor.decompress>` The :meth:`LZMADecompressor.decompress <lzma.LZMADecompressor.decompress>`
method now accepts an optional *max_length* argument to limit the maximum method now accepts an optional *max_length* argument to limit the maximum
size of decompressed data. size of decompressed data.
(Contributed by Martin Panter in :issue:`15955`.) (Contributed by Martin Panter in :issue:`15955`.)
...@@ -1005,7 +1008,7 @@ Storchaka in :issue:`22486`.) ...@@ -1005,7 +1008,7 @@ Storchaka in :issue:`22486`.)
operator operator
-------- --------
The :mod:`operator` :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, :func:`~operator.itemgetter`,
and :func:`~operator.methodcaller` objects now support pickling. and :func:`~operator.methodcaller` objects now support pickling.
(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.) (Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)
...@@ -1032,15 +1035,15 @@ use ``/dev/urandom`` and avoiding failures due to potential file descriptor ...@@ -1032,15 +1035,15 @@ use ``/dev/urandom`` and avoiding failures due to potential file descriptor
exhaustion. (Contributed by Victor Stinner in :issue:`22181`.) exhaustion. (Contributed by Victor Stinner in :issue:`22181`.)
New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow to New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow to
get and set the file descriptor blocking mode (:data:`~os.O_NONBLOCK`.) get and set a file descriptor blocking mode (:data:`~os.O_NONBLOCK`.)
(Contributed by Victor Stinner in :issue:`22054`.) (Contributed by Victor Stinner in :issue:`22054`.)
The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now supported The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now supported
on Windows. (Contributed by Steve Dower in :issue:`23668`.) on Windows. (Contributed by Steve Dower in :issue:`23668`.)
There is a new :func:`~os.path.commonpath` function returning the longest There is a new :func:`os.path.commonpath` function returning the longest
common sub-path of each passed pathname. Unlike the common sub-path of each passed pathname. Unlike the
:func:`~os.path.commonprefix` function, it always returns a valid :func:`os.path.commonprefix` function, it always returns a valid
path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.) path. (Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)
...@@ -1048,8 +1051,8 @@ pathlib ...@@ -1048,8 +1051,8 @@ pathlib
------- -------
The new :meth:`Path.samefile <pathlib.Path.samefile>` method can be used The new :meth:`Path.samefile <pathlib.Path.samefile>` method can be used
to check if the passed :class:`~pathlib.Path` object or a :class:`str` path, to check whether the path points to the same file as other path, which can be
point to the same file. either an another :class:`~pathlib.Path` object, or a string.
(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.) (Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)
The :meth:`Path.mkdir <pathlib.Path.mkdir>` method how accepts a new optional The :meth:`Path.mkdir <pathlib.Path.mkdir>` method how accepts a new optional
...@@ -1070,16 +1073,16 @@ pickle ...@@ -1070,16 +1073,16 @@ pickle
------ ------
Nested objects, such as unbound methods or nested classes, can now be pickled Nested objects, such as unbound methods or nested classes, can now be pickled
using :ref:`pickle protocols <pickle-protocols>` older than protocol version 4, using :ref:`pickle protocols <pickle-protocols>` older than protocol version 4.
which already supported these cases. (Contributed by Serhiy Storchaka in Protocol version 4 already supports these cases. (Contributed by Serhiy
:issue:`23611`.) Storchaka in :issue:`23611`.)
poplib poplib
------ ------
A new command :meth:`POP3.utf8 <poplib.POP3.utf8>` enables :rfc:`6856` A new :meth:`POP3.utf8 <poplib.POP3.utf8>` command enables :rfc:`6856`
(internationalized email) support, if the POP server supports it. (Internationalized Email) support, if a POP server supports it.
(Contributed by Milan OberKirch in :issue:`21804`.) (Contributed by Milan OberKirch in :issue:`21804`.)
...@@ -1090,15 +1093,15 @@ The number of capturing groups in regular expression is no longer limited by ...@@ -1090,15 +1093,15 @@ The number of capturing groups in regular expression is no longer limited by
100. (Contributed by Serhiy Storchaka in :issue:`22437`.) 100. (Contributed by Serhiy Storchaka in :issue:`22437`.)
The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched
groups with empty strings instead of rising an exception. groups with empty strings instead of raising an exception.
(Contributed by Serhiy Storchaka in :issue:`1519638`.) (Contributed by Serhiy Storchaka in :issue:`1519638`.)
readline readline
-------- --------
The new :func:`~readline.append_history_file` function can be used to append A new :func:`~readline.append_history_file` function can be used to append
the specified number of trailing elements in history to a given file. the specified number of trailing elements in history to the given file.
(Contributed by Bruno Cauet in :issue:`22940`.) (Contributed by Bruno Cauet in :issue:`22940`.)
...@@ -1111,7 +1114,7 @@ the default :func:`~shutil.copy2` if there is a need to ignore file metadata ...@@ -1111,7 +1114,7 @@ the default :func:`~shutil.copy2` if there is a need to ignore file metadata
when moving. when moving.
(Contributed by Claudiu Popa in :issue:`19840`.) (Contributed by Claudiu Popa in :issue:`19840`.)
The :func:`~shutil.make_archive` function now supports *xztar* format. The :func:`~shutil.make_archive` function now supports the *xztar* format.
(Contributed by Serhiy Storchaka in :issue:`5411`.) (Contributed by Serhiy Storchaka in :issue:`5411`.)
...@@ -1121,7 +1124,7 @@ signal ...@@ -1121,7 +1124,7 @@ signal
On Windows, the :func:`~signal.set_wakeup_fd` function now also supports On Windows, the :func:`~signal.set_wakeup_fd` function now also supports
socket handles. (Contributed by Victor Stinner in :issue:`22018`.) socket handles. (Contributed by Victor Stinner in :issue:`22018`.)
Various ``SIG*`` constants in :mod:`signal` module have been converted into Various ``SIG*`` constants in the :mod:`signal` module have been converted into
:mod:`Enums <enum>`. This allows meaningful names to be printed :mod:`Enums <enum>`. This allows meaningful names to be printed
during debugging, instead of integer "magic numbers". during debugging, instead of integer "magic numbers".
(Contributed by Giampaolo Rodola' in :issue:`21076`.) (Contributed by Giampaolo Rodola' in :issue:`21076`.)
...@@ -1133,7 +1136,8 @@ smtpd ...@@ -1133,7 +1136,8 @@ smtpd
Both :class:`~smtpd.SMTPServer` and :class:`~smtpd.SMTPChannel` classes now Both :class:`~smtpd.SMTPServer` and :class:`~smtpd.SMTPChannel` classes now
accept a *decode_data* keyword argument to determine if the ``DATA`` portion of accept a *decode_data* keyword argument to determine if the ``DATA`` portion of
the SMTP transaction is decoded using the ``"utf-8"`` codec or is instead the SMTP transaction is decoded using the ``"utf-8"`` codec or is instead
provided to :meth:`SMTPServer.process_message <smtpd.SMTPServer.process_message>` provided to the
:meth:`SMTPServer.process_message <smtpd.SMTPServer.process_message>`
method as a byte string. The default is ``True`` for backward compatibility method as a byte string. The default is ``True`` for backward compatibility
reasons, but will change to ``False`` in Python 3.6. If *decode_data* is set reasons, but will change to ``False`` in Python 3.6. If *decode_data* is set
to ``False``, the :meth:`~smtpd.SMTPServer.process_message` method must to ``False``, the :meth:`~smtpd.SMTPServer.process_message` method must
...@@ -1167,9 +1171,9 @@ A new :meth:`SMTP.auth <smtplib.SMTP.auth>` method provides a convenient way to ...@@ -1167,9 +1171,9 @@ A new :meth:`SMTP.auth <smtplib.SMTP.auth>` method provides a convenient way to
implement custom authentication mechanisms. (Contributed by Milan implement custom authentication mechanisms. (Contributed by Milan
Oberkirch in :issue:`15014`.) Oberkirch in :issue:`15014`.)
Additional debuglevel (2) shows timestamps for debug messages in The :meth:`SMTP.set_debuglevel <smtplib.SMTP.set_debuglevel>` method now
:class:`smtplib.SMTP`. (Contributed by Gavin Chappell and Maciej Szulik in accepts an additional debuglevel (2), which enables timestamps in debug
:issue:`16914`.) messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:`16914`.)
Both :meth:`SMTP.sendmail <smtplib.SMTP.sendmail>` and Both :meth:`SMTP.sendmail <smtplib.SMTP.sendmail>` and
:meth:`SMTP.send_message <smtplib.SMTP.send_message>` methods now :meth:`SMTP.send_message <smtplib.SMTP.send_message>` methods now
...@@ -1180,8 +1184,8 @@ support support :rfc:`6531` (SMTPUTF8). ...@@ -1180,8 +1184,8 @@ support support :rfc:`6531` (SMTPUTF8).
sndhdr sndhdr
------ ------
The :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` functions now return :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` functions now return
a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa in a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa in
:issue:`18615`.) :issue:`18615`.)
...@@ -1194,14 +1198,14 @@ Memory BIO Support ...@@ -1194,14 +1198,14 @@ Memory BIO Support
(Contributed by Geert Jansen in :issue:`21965`.) (Contributed by Geert Jansen in :issue:`21965`.)
The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol
support for cases when the network IO capabilities of :class:`~ssl.SSLSocket` support for cases when the network I/O capabilities of :class:`~ssl.SSLSocket`
are not necessary or suboptimal. :class:`~ssl.SSLObject` represents are not necessary or suboptimal. :class:`~ssl.SSLObject` represents
an SSL protocol instance, but does not implement any network IO methods, and an SSL protocol instance, but does not implement any network I/O methods, and
instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO`
class can be used to pass data between Python and an SSL protocol instance. class can be used to pass data between Python and an SSL protocol instance.
The memory BIO SSL support is primarily intended to be used in frameworks The memory BIO SSL support is primarily intended to be used in frameworks
implementing asynchronous IO for which :class:`~ssl.SSLObject` IO readiness implementing asynchronous I/O for which :class:`~ssl.SSLSocket`'s readiness
model ("select/poll") is inefficient. model ("select/poll") is inefficient.
A new :meth:`SSLContext.wrap_bio <ssl.SSLContext.wrap_bio>` method can be used A new :meth:`SSLContext.wrap_bio <ssl.SSLContext.wrap_bio>` method can be used
...@@ -1213,12 +1217,12 @@ Application-Layer Protocol Negotiation Support ...@@ -1213,12 +1217,12 @@ Application-Layer Protocol Negotiation Support
(Contributed by Benjamin Peterson in :issue:`20188`.) (Contributed by Benjamin Peterson in :issue:`20188`.)
Where OpenSSL support is present, :mod:`ssl` module now implements * Where OpenSSL support is present, :mod:`ssl` module now implements
Application-Layer Protocol Negotiation* TLS extension as described *Application-Layer Protocol Negotiation* TLS extension as described
in :rfc:`7301`. in :rfc:`7301`.
The new :meth:`SSLContext.set_alpn_protocols <ssl.SSLContext.set_alpn_protocols>` The new :meth:`SSLContext.set_alpn_protocols <ssl.SSLContext.set_alpn_protocols>`
can be used to specify which protocols the socket should advertise during can be used to specify which protocols a socket should advertise during
the TLS handshake. the TLS handshake.
The new The new
...@@ -1271,7 +1275,7 @@ Functions with timeouts now use a monotonic clock, instead of a system clock. ...@@ -1271,7 +1275,7 @@ Functions with timeouts now use a monotonic clock, instead of a system clock.
(Contributed by Victor Stinner in :issue:`22043`.) (Contributed by Victor Stinner in :issue:`22043`.)
A new :meth:`socket.sendfile <socket.socket.sendfile>` method allows to A new :meth:`socket.sendfile <socket.socket.sendfile>` method allows to
send a file over a socket by using high-performance :func:`os.sendfile` send a file over a socket by using the high-performance :func:`os.sendfile`
function on UNIX resulting in uploads being from 2 to 3 times faster than when function on UNIX resulting in uploads being from 2 to 3 times faster than when
using plain :meth:`socket.send <socket.socket.send>`. using plain :meth:`socket.send <socket.socket.send>`.
(Contributed by Giampaolo Rodola' in :issue:`17552`.) (Contributed by Giampaolo Rodola' in :issue:`17552`.)
...@@ -1285,9 +1289,12 @@ now the maximum total duration to send all data. ...@@ -1285,9 +1289,12 @@ now the maximum total duration to send all data.
subprocess subprocess
---------- ----------
The new :func:`~subprocess.run` function has been added and is the recommended The new :func:`~subprocess.run` function has been added.
approach to invoking subprocesses. It runs the specified command and It runs the specified command and and returns a
and returns a :class:`~subprocess.CompletedProcess` object. :class:`~subprocess.CompletedProcess` object, which describes a finished
process. The new API is more consistent and is the recommended approach
to invoking subprocesses in Python code that does not need to maintain
compatibility with earlier Python versions.
(Contributed by Thomas Kluyver in :issue:`23342`.) (Contributed by Thomas Kluyver in :issue:`23342`.)
...@@ -1295,13 +1302,13 @@ sys ...@@ -1295,13 +1302,13 @@ sys
--- ---
A new :func:`~sys.set_coroutine_wrapper` function allows setting a global A new :func:`~sys.set_coroutine_wrapper` function allows setting a global
hook that will be called whenever a :ref:`coro object <coro-objects>` hook that will be called whenever a :term:`coroutine object <coroutine>`
is created. Essentially, it works like a global coroutine decorator. A is created by an :keyword:`async def` function. A corresponding
corresponding :func:`~sys.get_coroutine_wrapper` can be used to obtain :func:`~sys.get_coroutine_wrapper` can be used to obtain a currently set
a currently set wrapper. Both functions are provisional, and are intended wrapper. Both functions are provisional, and are intended for debugging
for debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.) purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)
There is a new :func:`~sys.is_finalizing` function to check if the Python A new :func:`~sys.is_finalizing` function can be used to check if the Python
interpreter is :term:`shutting down <interpreter shutdown>`. interpreter is :term:`shutting down <interpreter shutdown>`.
(Contributed by Antoine Pitrou in :issue:`22696`.) (Contributed by Antoine Pitrou in :issue:`22696`.)
...@@ -1320,7 +1327,7 @@ tarfile ...@@ -1320,7 +1327,7 @@ tarfile
The *mode* argument of the :func:`~tarfile.open` function now accepts ``"x"`` The *mode* argument of the :func:`~tarfile.open` function now accepts ``"x"``
to request exclusive creation. (Contributed by Berker Peksag in :issue:`21717`.) to request exclusive creation. (Contributed by Berker Peksag in :issue:`21717`.)
The :meth:`TarFile.extractall <tarfile.TarFile.extractall>` and :meth:`TarFile.extractall <tarfile.TarFile.extractall>` and
:meth:`TarFile.extract <tarfile.TarFile.extract>` methods now take a keyword :meth:`TarFile.extract <tarfile.TarFile.extract>` methods now take a keyword
argument *numeric_only*. If set to ``True``, the extracted files and argument *numeric_only*. If set to ``True``, the extracted files and
directories will be owned by the numeric ``uid`` and ``gid`` from the tarfile. directories will be owned by the numeric ``uid`` and ``gid`` from the tarfile.
...@@ -1332,7 +1339,7 @@ they will be owned by the named user and group in the tarfile. ...@@ -1332,7 +1339,7 @@ they will be owned by the named user and group in the tarfile.
threading threading
--------- ---------
The :meth:`Lock.acquire <threading.Lock.acquire>` and Both :meth:`Lock.acquire <threading.Lock.acquire>` and
:meth:`RLock.acquire <threading.RLock.acquire>` methods :meth:`RLock.acquire <threading.RLock.acquire>` methods
now use a monotonic clock for timeout management. now use a monotonic clock for timeout management.
(Contributed by Victor Stinner in :issue:`22043`.) (Contributed by Victor Stinner in :issue:`22043`.)
...@@ -1348,9 +1355,9 @@ The :func:`~time.monotonic` function is now always available. ...@@ -1348,9 +1355,9 @@ The :func:`~time.monotonic` function is now always available.
timeit timeit
------ ------
New command line option ``-u`` or ``--unit=U`` to specify a time New command line option ``-u`` or ``--unit=U`` can be used to specify the time
unit for the timer output. Supported options are ``usec``, ``msec``, or ``sec``. unit for the timer output. Supported options are ``usec``, ``msec``,
(Contributed by Julian Gindi in :issue:`18983`.) or ``sec``. (Contributed by Julian Gindi in :issue:`18983`.)
tkinter tkinter
...@@ -1373,7 +1380,7 @@ New lightweight classes: :class:`~traceback.TracebackException`, ...@@ -1373,7 +1380,7 @@ New lightweight classes: :class:`~traceback.TracebackException`,
:class:`~traceback.StackSummary`, and :class:`traceback.FrameSummary`. :class:`~traceback.StackSummary`, and :class:`traceback.FrameSummary`.
(Contributed by Robert Collins in :issue:`17911`.) (Contributed by Robert Collins in :issue:`17911`.)
The :func:`~traceback.print_tb` and :func:`~traceback.print_stack` functions Both :func:`~traceback.print_tb` and :func:`~traceback.print_stack` functions
now support negative values for the *limit* argument. now support negative values for the *limit* argument.
(Contributed by Dmitry Kazakov in :issue:`22619`.) (Contributed by Dmitry Kazakov in :issue:`22619`.)
...@@ -1387,8 +1394,8 @@ A new :func:`~types.coroutine` function to transform ...@@ -1387,8 +1394,8 @@ A new :func:`~types.coroutine` function to transform
:term:`awaitables <awaitable>`. :term:`awaitables <awaitable>`.
(Contributed by Yury Selivanov in :issue:`24017`.) (Contributed by Yury Selivanov in :issue:`24017`.)
A new :class:`~types.CoroutineType` is the type of :term:`coroutine` objects, A new :class:`~types.CoroutineType` is the type of :term:`coroutine` objects
produced by calling a function defined with an :keyword:`async def` statement. created by :keyword:`async def` functions.
(Contributed by Yury Selivanov in :issue:`24400`.) (Contributed by Yury Selivanov in :issue:`24400`.)
...@@ -1478,22 +1485,24 @@ Many functions in :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`, ...@@ -1478,22 +1485,24 @@ Many functions in :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`,
Optimizations Optimizations
============= =============
The :func:`os.walk` function has been sped up by 3-5 times on POSIX systems, The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX systems,
and by 7-20 times on Windows. This was done using the new :func:`os.scandir` and by 7 to 20 times on Windows. This was done using the new :func:`os.scandir`
function, which exposes file information from the underlying ``readdir`` or function, which exposes file information from the underlying ``readdir`` or
``FindFirstFile``/``FindNextFile`` system calls. (Contributed by ``FindFirstFile``/``FindNextFile`` system calls. (Contributed by
Ben Hoyt with help from Victor Stinner in :issue:`23605`.) Ben Hoyt with help from Victor Stinner in :issue:`23605`.)
Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses less Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses less
memory for large objects. ``calloc()`` is used instead of ``malloc()`` to memory for large objects. ``calloc()`` is used instead of ``malloc()`` to
allocate memory for these objects. allocate memory for these objects.
(Contributed by Victor Stinner in :issue:`21233`.)
Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and
:class:`~ipaddress.IPv6Network` have been massively sped up, such as :class:`~ipaddress.IPv6Network` have been massively sped up, such as
:meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`,
:func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`.
The speed up can range from 3 to 15 times. The speed up can range from 3 to 15 times.
(See :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.) (Contributed by Antoine Pitrou, Michel Albert, and Markus in
:issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)
Pickling of :mod:`ipaddress` objects was optimized to produce significantly Pickling of :mod:`ipaddress` objects was optimized to produce significantly
smaller output. (Contributed by Serhiy Storchaka in :issue:`23133`.) smaller output. (Contributed by Serhiy Storchaka in :issue:`23133`.)
...@@ -1572,7 +1581,7 @@ loaded): ...@@ -1572,7 +1581,7 @@ loaded):
``linux-gnu32`` (and ``<architecture>`` will be ``x86_64``). ``linux-gnu32`` (and ``<architecture>`` will be ``x86_64``).
* On Windows, extension module filenames end with * On Windows, extension module filenames end with
``.<debug>.cp<major><minor>-<platform>.pyd``: ``<debug>.cp<major><minor>-<platform>.pyd``:
* ``<major>`` is the major number of the Python version; * ``<major>`` is the major number of the Python version;
for Python 3.5 this is ``3``. for Python 3.5 this is ``3``.
...@@ -1607,7 +1616,8 @@ become proper keywords in Python 3.7. ...@@ -1607,7 +1616,8 @@ become proper keywords in Python 3.7.
Unsupported Operating Systems Unsupported Operating Systems
----------------------------- -----------------------------
Per :PEP:`11`, Microsoft support of Windows XP has ended. Windows XP is no longer supported by Microsoft, thus, per :PEP:`11`, CPython
3.5 is no longer officially supported on this OS.
Deprecated Python modules, functions and methods Deprecated Python modules, functions and methods
...@@ -1782,6 +1792,10 @@ Changes in the Python API ...@@ -1782,6 +1792,10 @@ Changes in the Python API
* The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux * The :mod:`socket` module now exports the CAN_RAW_FD_FRAMES constant on linux
3.6 and greater. 3.6 and greater.
* The :func:`~ssl.cert_time_to_seconds` function now interprets the input time
as UTC and not as local time, per :rfc:`5280`. Additionally, the return
value is always an :class:`int`. (Contributed by Akira Li in :issue:`19940`.)
* The ``pygettext.py`` Tool now uses the standard +NNNN format for timezones in * The ``pygettext.py`` Tool now uses the standard +NNNN format for timezones in
the POT-Creation-Date header. the POT-Creation-Date header.
......
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