[Python-checkins] (no subject)
Łukasz Langa
webhook-mailer at python.org
Mon Oct 14 09:10:44 EDT 2019
To: python-checkins at python.org
Subject: bpo-37759: Polish What's New in Python 3.8. (#16769)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/298439ce3fb01de6c3110cc4847e6afe3253=
ba7a
commit: 298439ce3fb01de6c3110cc4847e6afe3253ba7a
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: =C5=81ukasz Langa <lukasz at langa.pl>
date: 2019-10-14T15:10:40+02:00
summary:
bpo-37759: Polish What's New in Python 3.8. (#16769)
files:
M Doc/whatsnew/3.8.rst
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 0c59ef8015a58..8108fb7e14704 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -212,6 +212,7 @@ subdirectories).
=20
(Contributed by Carl Meyer in :issue:`33499`.)
=20
+
Debug build uses the same ABI as release build
-----------------------------------------------
=20
@@ -285,6 +286,7 @@ calculations can be shown::
=20
(Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)
=20
+
PEP 587: Python Initialization Configuration
--------------------------------------------
=20
@@ -411,7 +413,8 @@ Other Language Changes
* The syntax allowed for keyword names in function calls was further
restricted. In particular, ``f((keyword)=3Darg)`` is no longer allowed. It=
was
never intended to permit more than a bare name on the left-hand side of a
- keyword argument assignment term. See :issue:`34641`.
+ keyword argument assignment term.
+ (Contributed by Benjamin Peterson in :issue:`34641`.)
=20
* Generalized iterable unpacking in :keyword:`yield` and
:keyword:`return` statements no longer requires enclosing parentheses.
@@ -425,7 +428,6 @@ Other Language Changes
>>> parse('simpsons homer marge bart lisa sally')
('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'sally')
=20
-
(Contributed by David Cuthbert and Jordan Chapman in :issue:`32117`.)
=20
* When a comma is missed in code such as ``[(10, 20) (30, 40)]``, the
@@ -521,6 +523,8 @@ Other Language Changes
'=C5=82ukasz langa': '=C5=81ukasz Langa',
'walter d=C3=B6rwald': 'Walter D=C3=B6rwald'}
=20
+ (Contributed by J=C3=B6rn Heissler in :issue:`35224`.)
+
=20
New Modules
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -544,13 +548,12 @@ New Modules
PackagePath('requests-2.22.0.dist-info/RECORD'),
PackagePath('requests-2.22.0.dist-info/WHEEL')]
=20
- (Contributed in :issue:`34632` by Barry Warsaw and Jason R. Coombs.)
+ (Contributed by Barry Warsaw and Jason R. Coombs in :issue:`34632`.)
=20
=20
Improved Modules
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
-
ast
---
=20
@@ -558,6 +561,11 @@ AST nodes now have ``end_lineno`` and ``end_col_offset``=
attributes,
which give the precise location of the end of the node. (This only
applies to nodes that have ``lineno`` and ``col_offset`` attributes.)
=20
+New function :func:`ast.get_source_segment` returns the source code
+for a specific AST node.
+
+(Contributed by Ivan Levkivskyi in :issue:`33416`.)
+
The :func:`ast.parse` function has some new flags:
=20
* ``type_comments=3DTrue`` causes it to return the text of :pep:`484` and
@@ -570,8 +578,7 @@ The :func:`ast.parse` function has some new flags:
version. (For example, ``feature_version=3D(3, 4)`` will treat
``async`` and ``await`` as non-reserved words.)
=20
-New function :func:`ast.get_source_segment` returns the source code
-for a specific AST node.
+(Contributed by Guido van Rossum in :issue:`35766`.)
=20
=20
asyncio
@@ -596,7 +603,6 @@ The :func:`compile` built-in has been improved to accept =
the
:func:`compile` will allow top-level ``await``, ``async for`` and ``async wi=
th``
constructs that are usually considered invalid syntax. Asynchronous code obj=
ect
marked with the ``CO_COROUTINE`` flag may then be returned.
-
(Contributed by Matthias Bussonnier in :issue:`34616`)
=20
=20
@@ -627,6 +633,7 @@ to specify flags for the underlying ``LoadLibraryEx`` cal=
l. The default flags ar
set to only load DLL dependencies from trusted locations, including the path
where the DLL is stored (if a full or partial path is used to load the initi=
al
DLL) and paths added by :func:`~os.add_dll_directory`.
+(Contributed by Steve Dower in :issue:`36085`.)
=20
=20
datetime
@@ -660,8 +667,8 @@ gc
--
=20
:func:`~gc.get_objects` can now receive an optional *generation* parameter
-indicating a generation to get objects from. Contributed in
-:issue:`36016` by Pablo Galindo.
+indicating a generation to get objects from.
+(Contributed by Pablo Galindo in :issue:`36016`.)
=20
=20
gettext
@@ -723,6 +730,8 @@ for :func:`property`, :func:`classmethod`, and :func:`sta=
ticmethod`::
self.bit_rate =3D round(bit_rate / 1000.0, 1)
self.duration =3D ceil(duration)
=20
+(Contributed by Raymond Hettinger in :issue:`36326`.)
+
=20
io
--
@@ -780,7 +789,7 @@ multiprocessing
---------------
=20
Added new :mod:`multiprocessing.shared_memory` module.
-(Contributed Davin Potts in :issue:`35813`.)
+(Contributed by Davin Potts in :issue:`35813`.)
=20
On macOS, the *spawn* start method is now used by default.
(Contributed by Victor Stinner in :issue:`33725`.)
@@ -792,6 +801,7 @@ os
Added new function :func:`~os.add_dll_directory` on Windows for providing
additional search paths for native dependencies when importing extension
modules or loading DLLs using :mod:`ctypes`.
+(Contributed by Steve Dower in :issue:`36085`.)
=20
A new :func:`os.memfd_create` function was added to wrap the
``memfd_create()`` syscall.
@@ -812,6 +822,8 @@ and so code that checks ``islink`` first will continue to=
treat junctions as
directories, while code that handles errors from :func:`os.readlink` may now
treat junctions as links.
=20
+(Contributed by Steve Dower in :issue:`37834`.)
+
=20
os.path
-------
@@ -827,6 +839,7 @@ characters or bytes unrepresentable at the OS level.
:func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE`
environment variable and does not use :envvar:`HOME`, which is not normally =
set
for regular user accounts.
+(Contributed by Anthony Sottile in :issue:`36264`.)
=20
:func:`~os.path.isdir` on Windows no longer returns true for a link to a
non-existent directory.
@@ -834,6 +847,8 @@ non-existent directory.
:func:`~os.path.realpath` on Windows now resolves reparse points, including
symlinks and directory junctions.
=20
+(Contributed by Steve Dower in :issue:`37834`.)
+
=20
pathlib
-------
@@ -883,11 +898,12 @@ py_compile
=20
=20
shlex
-----------
+-----
=20
The new :func:`shlex.join` function acts as the inverse of :func:`shlex.spli=
t`.
(Contributed by Bo Bayles in :issue:`32102`.)
=20
+
shutil
------
=20
@@ -901,6 +917,7 @@ inherited from the corresponding change to the :mod:`tarf=
ile` module.
=20
:func:`shutil.rmtree` on Windows now removes directory junctions without
recursively removing their contents first.
+(Contributed by Steve Dower in :issue:`37834`.)
=20
=20
socket
@@ -995,18 +1012,18 @@ in a standardized and extensible format, and offers se=
veral other benefits.
threading
---------
=20
-* Add a new :func:`threading.excepthook` function which handles uncaught
- :meth:`threading.Thread.run` exception. It can be overridden to control how
- uncaught :meth:`threading.Thread.run` exceptions are handled.
- (Contributed by Victor Stinner in :issue:`1230540`.)
+Add a new :func:`threading.excepthook` function which handles uncaught
+:meth:`threading.Thread.run` exception. It can be overridden to control how
+uncaught :meth:`threading.Thread.run` exceptions are handled.
+(Contributed by Victor Stinner in :issue:`1230540`.)
=20
-* Add a new
- :func:`threading.get_native_id` function and a :data:`~threading.Thread.na=
tive_id`
- attribute to the :class:`threading.Thread` class. These return the native
- integral Thread ID of the current thread assigned by the kernel.
- This feature is only available on certain platforms, see
- :func:`get_native_id <threading.get_native_id>` for more information.
- (Contributed by Jake Tesler in :issue:`36084`.)
+Add a new :func:`threading.get_native_id` function and
+a :data:`~threading.Thread.native_id`
+attribute to the :class:`threading.Thread` class. These return the native
+integral Thread ID of the current thread assigned by the kernel.
+This feature is only available on certain platforms, see
+:func:`get_native_id <threading.get_native_id>` for more information.
+(Contributed by Jake Tesler in :issue:`36084`.)
=20
=20
tokenize
@@ -1017,6 +1034,7 @@ provided with input that does not have a trailing new l=
ine. This behavior
now matches what the C tokenizer does internally.
(Contributed by Ammar Askar in :issue:`33899`.)
=20
+
tkinter
-------
=20
@@ -1036,6 +1054,7 @@ The :class:`tkinter.PhotoImage` class now has
:meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by
Zackery Spytz in :issue:`25451`.)
=20
+
time
----
=20
@@ -1084,95 +1103,98 @@ The :mod:`typing` module incorporates several new fea=
tures:
unicodedata
-----------
=20
-* The :mod:`unicodedata` module has been upgraded to use the `Unicode 12.1.0
- <http://blog.unicode.org/2019/05/unicode-12-1-en.html>`_ release.
+The :mod:`unicodedata` module has been upgraded to use the `Unicode 12.1.0
+<http://blog.unicode.org/2019/05/unicode-12-1-en.html>`_ release.
=20
-* New function :func:`~unicodedata.is_normalized` can be used to verify a st=
ring
- is in a specific normal form, often much faster than by actually normalizi=
ng
- the string. (Contributed by Max Belanger, David Euresti, and Greg Price in
- :issue:`32285` and :issue:`37966`).
+New function :func:`~unicodedata.is_normalized` can be used to verify a stri=
ng
+is in a specific normal form, often much faster than by actually normalizing
+the string. (Contributed by Max Belanger, David Euresti, and Greg Price in
+:issue:`32285` and :issue:`37966`).
=20
=20
unittest
--------
=20
-* Added :class:`AsyncMock` to support an asynchronous version of :class:`Moc=
k`.
- Appropriate new assert functions for testing have been added as well.
- (Contributed by Lisa Roach in :issue:`26467`).
+Added :class:`AsyncMock` to support an asynchronous version of :class:`Mock`.
+Appropriate new assert functions for testing have been added as well.
+(Contributed by Lisa Roach in :issue:`26467`).
=20
-* Added :func:`~unittest.addModuleCleanup()` and
- :meth:`~unittest.TestCase.addClassCleanup()` to unittest to support
- cleanups for :func:`~unittest.setUpModule()` and
- :meth:`~unittest.TestCase.setUpClass()`.
- (Contributed by Lisa Roach in :issue:`24412`.)
+Added :func:`~unittest.addModuleCleanup()` and
+:meth:`~unittest.TestCase.addClassCleanup()` to unittest to support
+cleanups for :func:`~unittest.setUpModule()` and
+:meth:`~unittest.TestCase.setUpClass()`.
+(Contributed by Lisa Roach in :issue:`24412`.)
=20
-* Several mock assert functions now also print a list of actual calls upon
- failure. (Contributed by Petter Strandmark in :issue:`35047`.)
+Several mock assert functions now also print a list of actual calls upon
+failure. (Contributed by Petter Strandmark in :issue:`35047`.)
=20
-* :mod:`unittest` module gained support for coroutines to be used as test ca=
ses
- with :class:`unittest.IsolatedAsyncioTestCase`.
- (Contributed by Andrew Svetlov in :issue:`32972`.)
+:mod:`unittest` module gained support for coroutines to be used as test cases
+with :class:`unittest.IsolatedAsyncioTestCase`.
+(Contributed by Andrew Svetlov in :issue:`32972`.)
=20
- Example::
+Example::
=20
- import unittest
+ import unittest
=20
=20
- class TestRequest(unittest.IsolatedAsyncioTestCase):
+ class TestRequest(unittest.IsolatedAsyncioTestCase):
=20
- async def asyncSetUp(self):
- self.connection =3D await AsyncConnection()
+ async def asyncSetUp(self):
+ self.connection =3D await AsyncConnection()
=20
- async def test_get(self):
- response =3D await self.connection.get("https://example.com")
- self.assertEqual(response.status_code, 200)
+ async def test_get(self):
+ response =3D await self.connection.get("https://example.com")
+ self.assertEqual(response.status_code, 200)
=20
- async def asyncTearDown(self):
- await self.connection.close()
+ async def asyncTearDown(self):
+ await self.connection.close()
=20
=20
- if __name__ =3D=3D "__main__":
- unittest.main()
+ if __name__ =3D=3D "__main__":
+ unittest.main()
=20
=20
venv
----
=20
-* :mod:`venv` now includes an ``Activate.ps1`` script on all platforms for
- activating virtual environments under PowerShell Core 6.1.
- (Contributed by Brett Cannon in :issue:`32718`.)
+:mod:`venv` now includes an ``Activate.ps1`` script on all platforms for
+activating virtual environments under PowerShell Core 6.1.
+(Contributed by Brett Cannon in :issue:`32718`.)
+
=20
weakref
-------
=20
-* The proxy objects returned by :func:`weakref.proxy` now support the matrix
- multiplication operators ``@`` and ``@=3D`` in addition to the other
- numeric operators. (Contributed by Mark Dickinson in :issue:`36669`.)
+The proxy objects returned by :func:`weakref.proxy` now support the matrix
+multiplication operators ``@`` and ``@=3D`` in addition to the other
+numeric operators. (Contributed by Mark Dickinson in :issue:`36669`.)
+
=20
xml
---
=20
-* As mitigation against DTD and external entity retrieval, the
- :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process
- external entities by default.
- (Contributed by Christian Heimes in :issue:`17239`.)
+As mitigation against DTD and external entity retrieval, the
+:mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process
+external entities by default.
+(Contributed by Christian Heimes in :issue:`17239`.)
=20
-* The ``.find*()`` methods in the :mod:`xml.etree.ElementTree` module
- support wildcard searches like ``{*}tag`` which ignores the namespace
- and ``{namespace}*`` which returns all tags in the given namespace.
- (Contributed by Stefan Behnel in :issue:`28238`.)
+The ``.find*()`` methods in the :mod:`xml.etree.ElementTree` module
+support wildcard searches like ``{*}tag`` which ignores the namespace
+and ``{namespace}*`` which returns all tags in the given namespace.
+(Contributed by Stefan Behnel in :issue:`28238`.)
=20
-* The :mod:`xml.etree.ElementTree` module provides a new function
- :func:`=E2=80=93xml.etree.ElementTree.canonicalize()` that implements C14N=
2.0.
- (Contributed by Stefan Behnel in :issue:`13611`.)
+The :mod:`xml.etree.ElementTree` module provides a new function
+:func:`=E2=80=93xml.etree.ElementTree.canonicalize()` that implements C14N 2=
.0.
+(Contributed by Stefan Behnel in :issue:`13611`.)
+
+The target object of :class:`xml.etree.ElementTree.XMLParser` can
+receive namespace declaration events through the new callback methods
+``start_ns()`` and ``end_ns()``. Additionally, the
+:class:`xml.etree.ElementTree.TreeBuilder` target can be configured
+to process events about comments and processing instructions to include
+them in the generated tree.
+(Contributed by Stefan Behnel in :issue:`36676` and :issue:`36673`.)
=20
-* The target object of :class:`xml.etree.ElementTree.XMLParser` can
- receive namespace declaration events through the new callback methods
- ``start_ns()`` and ``end_ns()``. Additionally, the
- :class:`xml.etree.ElementTree.TreeBuilder` target can be configured
- to process events about comments and processing instructions to include
- them in the generated tree.
- (Contributed by Stefan Behnel in :issue:`36676` and :issue:`36673`.)
=20
Optimizations
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@@ -1220,6 +1242,7 @@ Optimizations
(Contributed by Inada Naoki in :issue:`33597`)
=20
* :class:`uuid.UUID` now uses ``__slots__`` to reduce its memory footprint.
+ (Contributed by Wouter Bolsterlee and Tal Einat in :issue:`30977`)
=20
* Improved performance of :func:`operator.itemgetter` by 33%. Optimized
argument handling and added a fast path for the common case of a single
@@ -1412,7 +1435,8 @@ Deprecated
for the ``l*gettext()`` functions.
(Contributed by Serhiy Storchaka in :issue:`33710`.)
=20
-* The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread=
` has been deprecated.
+* The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread`
+ has been deprecated.
(Contributed by Dong-hee Na in :issue:`35283`.)
=20
* Many builtin and extension functions that take integer arguments will
@@ -1516,7 +1540,7 @@ Changes in Python behavior
=20
* The compiler now produces a :exc:`SyntaxWarning` when identity checks
(``is`` and ``is not``) are used with certain types of literals
- (e.g. strings, ints). These can often work by accident in CPython,
+ (e.g. strings, numbers). These can often work by accident in CPython,
but are not guaranteed by the language spec. The warning advises users
to use equality tests (``=3D=3D`` and ``!=3D``) instead.
(Contributed by Serhiy Storchaka in :issue:`34850`.)
@@ -1545,6 +1569,8 @@ Changes in Python behavior
:c:func:`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this
behavior is not desired, guard the call by checking :c:func:`_Py_IsFinaliz=
ing`
or :c:func:`sys.is_finalizing`.
+ (Contributed by Joannah Nanjekye in :issue:`36475`.)
+
=20
Changes in the Python API
-------------------------
@@ -1569,6 +1595,7 @@ Changes in the Python API
=20
* The :meth:`imap.IMAP4.logout` method no longer ignores silently arbitrary
exceptions.
+ (Contributed by Victor Stinner in :issue:`36348`.)
=20
* The function :func:`platform.popen` has been removed, after having been de=
precated since
Python 3.3: use :func:`os.popen` instead.
@@ -1657,8 +1684,9 @@ Changes in the Python API
* :func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFIL=
E`
environment variable and does not use :envvar:`HOME`, which is not normally
set for regular user accounts.
+ (Contributed by Anthony Sottile in :issue:`36264`.)
=20
-* The Exception :class:`asyncio.CancelledError` now inherits from
+* The exception :class:`asyncio.CancelledError` now inherits from
:class:`BaseException` rather than a :class:`Exception`.
(Contributed by Yury Selivanov in :issue:`13528`.)
=20
@@ -1675,7 +1703,7 @@ Changes in the Python API
directory while loading your library. Note that Windows 7 users will need =
to
ensure that Windows Update KB2533625 has been installed (this is also veri=
fied
by the installer).
- (See :issue:`36085`.)
+ (Contributed by Steve Dower in :issue:`36085`.)
=20
* The header files and functions related to pgen have been removed after its
replacement by a pure Python implementation. (Contributed by Pablo Galindo
@@ -1696,6 +1724,7 @@ Changes in the C API
field. It should be initialized to ``PY_MINOR_VERSION``. The field is igno=
red
by default, and is used if and only if ``PyCF_ONLY_AST`` flag is set in
*cf_flags*.
+ (Contributed by Guido van Rossum in :issue:`35766`.)
=20
* The :c:func:`PyEval_ReInitThreads` function has been removed from the C AP=
I.
It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child`
@@ -1742,7 +1771,9 @@ Changes in the C API
:c:func:`PyObject_GC_NewVar`, or any other custom allocator that uses
:c:func:`PyObject_Init` or :c:func:`PyObject_INIT`.
=20
- Example::
+ Example:
+
+ .. code-block:: c
=20
static foo_struct *
foo_new(PyObject *type) {
@@ -1759,7 +1790,9 @@ Changes in the C API
* Ensure that all custom ``tp_dealloc`` functions of heap-allocated types
decrease the type's reference count.
=20
- Example::
+ Example:
+
+ .. code-block:: c
=20
static void
foo_dealloc(foo_struct *instance) {
@@ -1776,7 +1809,9 @@ Changes in the C API
* The :c:macro:`Py_DEPRECATED()` macro has been implemented for MSVC.
The macro now must be placed before the symbol name.
=20
- Example::
+ Example:
+
+ .. code-block:: c
=20
Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
=20
@@ -1797,12 +1832,12 @@ Changes in the C API
* The functions :c:func:`PyNode_AddChild` and :c:func:`PyParser_AddToken` no=
w accept
two additional ``int`` arguments *end_lineno* and *end_col_offset*.
=20
-.. highlight:: shell
-
* The :file:`libpython38.a` file to allow MinGW tools to link directly again=
st
:file:`python38.dll` is no longer included in the regular Windows distribu=
tion.
If you require this file, it may be generated with the ``gendef`` and
- ``dlltool`` tools, which are part of the MinGW binutils package::
+ ``dlltool`` tools, which are part of the MinGW binutils package:
+
+ .. code-block:: shell
=20
gendef python38.dll > tmp.def
dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a
@@ -1813,7 +1848,7 @@ Changes in the C API
placed in the same directory as :file:`pythonXY.lib`, which is generally t=
he
:file:`libs` directory under your Python installation.
=20
-.. highlight:: python3
+ (Contributed by Steve Dower in :issue:`37351`.)
=20
=20
CPython bytecode changes
More information about the Python-checkins
mailing list