.. bpo: 40501
.. date: 2020-05-06-00-41-11
.. nonce: _61wv_
.. release date: 2020-05-19
.. section: Security

:mod:`uuid` no longer uses :mod:`ctypes` to load :file:`libuuid` or
:file:`rpcrt4.dll` at runtime.

..

.. bpo: 40663
.. date: 2020-05-17-20-38-12
.. nonce: u2aiZf
.. section: Core and Builtins

Correctly generate annotations where parentheses are omitted but required
(e.g: ``Type[(str, int, *other))]``.

..

.. bpo: 40596
.. date: 2020-05-11-20-53-52
.. nonce: dwOH_X
.. section: Core and Builtins

Fixed :meth:`str.isidentifier` for non-canonicalized strings containing
non-BMP characters on Windows.

..

.. bpo: 40593
.. date: 2020-05-11-13-50-52
.. nonce: yuOXj3
.. section: Core and Builtins

Improved syntax errors for invalid characters in source code.

..

.. bpo: 40585
.. date: 2020-05-11-00-19-42
.. nonce: yusknY
.. section: Core and Builtins

Fixed a bug when using :func:`codeop.compile_command` that was causing
exceptions to be swallowed with the new parser. Patch by Pablo Galindo

..

.. bpo: 40566
.. date: 2020-05-09-01-39-16
.. nonce: wlcjW_
.. section: Core and Builtins

Apply :pep:`573` to :mod:`abc`.

..

.. bpo: 40502
.. date: 2020-05-08-03-25-26
.. nonce: e-VCyL
.. section: Core and Builtins

Initialize ``n->n_col_offset``. (Patch by Joannah Nanjekye)

..

.. bpo: 40527
.. date: 2020-05-06-14-52-35
.. nonce: gTNKuy
.. section: Core and Builtins

Fix command line argument parsing: no longer write errors multiple times
into stderr.

..

.. bpo: 1635741
.. date: 2020-05-05-21-11-35
.. nonce: ggwD3C
.. section: Core and Builtins

Port :mod:`errno` to multiphase initialization (:pep:`489`).

..

.. bpo: 40523
.. date: 2020-05-05-20-36-15
.. nonce: hKZVTB
.. section: Core and Builtins

Add pass-throughs for :func:`hash` and :func:`reversed` to
:class:`weakref.proxy` objects. Patch by Pablo Galindo.

..

.. bpo: 1635741
.. date: 2020-05-05-03-36-27
.. nonce: ARv1YV
.. section: Core and Builtins

Port :mod:`syslog` to multiphase initialization (:pep:`489`).

..

.. bpo: 40246
.. date: 2020-05-03-23-28-11
.. nonce: c1D7x8
.. section: Core and Builtins

Reporting a specialised error message for invalid string prefixes, which was
introduced in :issue:`40246`, is being reverted due to backwards
compatibility concerns for strings that immediately follow a reserved
keyword without whitespace between them. Constructs like `bg="#d00" if clear
else"#fca"` were failing to parse, which is not an acceptable breakage on
such short notice.

..

.. bpo: 40417
.. date: 2020-05-01-19-04-52
.. nonce: Sti2lJ
.. section: Core and Builtins

Fix imp module deprecation warning when PyImport_ReloadModule is called.
Patch by Robert Rouhani.

..

.. bpo: 40408
.. date: 2020-05-01-15-36-14
.. nonce: XzQI59
.. section: Core and Builtins

Fixed support of nested type variables in GenericAlias (e.g.
``list[list[T]]``).

..

.. bpo: 1635741
.. date: 2020-04-30-01-44-42
.. nonce: GKtjqr
.. section: Core and Builtins

Port _stat module to multiphase initialization (:pep:`489`).

..

.. bpo: 29587
.. date: 2020-04-30-00-50-25
.. nonce: oEwSq
.. section: Core and Builtins

Enable implicit exception chaining when calling :meth:`generator.throw`.

..

.. bpo: 40328
.. date: 2020-04-19-22-23-32
.. nonce: gWJ53f
.. section: Core and Builtins

Add tools for generating mappings headers for CJKCodecs.

..

.. bpo: 40228
.. date: 2020-04-08-17-02-35
.. nonce: bRaaJ-
.. section: Core and Builtins

Setting frame.f_lineno is now robust w.r.t. changes in the
source-to-bytecode compiler

..

.. bpo: 38880
.. date: 2019-11-22-14-34-47
.. nonce: evcCPa
.. section: Core and Builtins

Added the ability to list interpreters associated with channel ends in the
internal subinterpreters module.

..

.. bpo: 37986
.. date: 2019-11-20-09-50-58
.. nonce: o0lmA7
.. section: Core and Builtins

Improve performance of :c:func:`PyLong_FromDouble` for values that fit into
:c:type:`long`.

..

.. bpo: 40662
.. date: 2020-05-18-12-56-45
.. nonce: dfornR
.. section: Library

Fixed :func:`ast.get_source_segment` for ast nodes that have incomplete
location information. Patch by Irit Katriel.

..

.. bpo: 40665
.. date: 2020-05-17-21-56-38
.. nonce: msB7u5
.. section: Library

Convert :mod:`bisect` to use Argument Clinic.

..

.. bpo: 40536
.. date: 2020-05-17-14-00-12
.. nonce: FCpoRA
.. section: Library

Added the :func:`~zoneinfo.available_timezones` function to the
:mod:`zoneinfo` module. Patch by Paul Ganssle.

..

.. bpo: 40645
.. date: 2020-05-16-19-34-38
.. nonce: 7ibMt-
.. section: Library

The :class:`hmac.HMAC` exposes internal implementation details. The
attributes ``digest_cons``, ``inner``, and ``outer`` are deprecated and will
be removed in the future.

..

.. bpo: 40645
.. date: 2020-05-16-17-05-02
.. nonce: wYSkjT
.. section: Library

The internal module ``_hashlib`` wraps and exposes OpenSSL's HMAC API. The
new code will be used in Python 3.10 after the internal implementation
details of the pure Python HMAC module are no longer part of the public API.

..

.. bpo: 40637
.. date: 2020-05-15-21-57-10
.. nonce: lb3Bnp
.. section: Library

Builtin hash modules can now be disabled or selectively enabled with
``configure --with-builtin-hashlib-hashes=sha3,blake1`` or
``--without-builtin-hashlib-hashes``.

..

.. bpo: 37630
.. date: 2020-05-15-19-53-18
.. nonce: O5kgAw
.. section: Library

The :mod:`hashlib` module can now use SHA3 hashes and SHAKE XOF from OpenSSL
when available.

..

.. bpo: 40479
.. date: 2020-05-15-17-38-21
.. nonce: yamSCh
.. section: Library

The :mod:`hashlib` now compiles with OpenSSL 3.0.0-alpha2.

..

.. bpo: 40257
.. date: 2020-05-13-23-10-25
.. nonce: aR4TGp
.. section: Library

Revert changes to :func:`inspect.getdoc`.

..

.. bpo: 40607
.. date: 2020-05-13-15-32-13
.. nonce: uSPFCi
.. section: Library

When cancelling a task due to timeout, :meth:`asyncio.wait_for` will now
propagate the exception if an error happens during cancellation. Patch by
Roman Skurikhin.

..

.. bpo: 40612
.. date: 2020-05-13-10-23-29
.. nonce: gOIreM
.. section: Library

Fix edge cases in SyntaxError formatting. If the offset is <= 0, no caret is
printed. If the offset is > line length, the caret is printed pointing just
after the last character.

..

.. bpo: 40597
.. date: 2020-05-11-19-17-23
.. nonce: 4SGfgm
.. section: Library

If text content lines are longer than policy.max_line_length, always use a
content-encoding to make sure they are wrapped.

..

.. bpo: 40571
.. date: 2020-05-09-15-38-25
.. nonce: kOXZGC
.. section: Library

Added functools.cache() as a simpler, more discoverable way to access the
unbounded cache variant of lru_cache(maxsize=None).

..

.. bpo: 40503
.. date: 2020-05-08-15-48-39
.. nonce: elZyxc
.. section: Library

:pep:`615`, the :mod:`zoneinfo` module. Adds support for the IANA time zone
database.

..

.. bpo: 40397
.. date: 2020-05-07-21-22-04
.. nonce: PVWFAn
.. section: Library

Removed attributes ``__args__`` and ``__parameters__`` from special generic
aliases like ``typing.List`` (not subscripted).

..

.. bpo: 40549
.. date: 2020-05-07-20-11-51
.. nonce: 6FiRSV
.. section: Library

Convert posixmodule.c ("posix" or "nt" module) to the multiphase
initialization (PEP 489).

..

.. bpo: 31033
.. date: 2020-05-07-06-41-20
.. nonce: waCj3n
.. section: Library

Add a ``msg`` argument to :meth:`Future.cancel` and :meth:`Task.cancel`.

..

.. bpo: 40541
.. date: 2020-05-06-15-36-47
.. nonce: LlYghL
.. section: Library

Added an optional *counts* parameter to random.sample().

..

.. bpo: 40515
.. date: 2020-05-06-13-51-19
.. nonce: TUCvYB
.. section: Library

The :mod:`ssl` and :mod:`hashlib` modules now actively check that OpenSSL is
build with thread support. Python 3.7.0 made thread support mandatory and no
longer works safely with a no-thread builds.

..

.. bpo: 31033
.. date: 2020-05-06-02-33-00
.. nonce: aX12pw
.. section: Library

When a :class:`asyncio.Task` is cancelled, the exception traceback now
chains all the way back to where the task was first interrupted.

..

.. bpo: 40504
.. date: 2020-05-05-17-12-47
.. nonce: EX6wPn
.. section: Library

:func:`functools.lru_cache` objects can now be the targets of weakrefs.

..

.. bpo: 40559
.. date: 2020-05-05-08-12-51
.. nonce: 112wwa
.. section: Library

Fix possible memory leak in the C implementation of :class:`asyncio.Task`.

..

.. bpo: 40480
.. date: 2020-05-04-21-21-43
.. nonce: mjldWa
.. section: Library

``fnmatch.fnmatch()`` could take exponential time in the presence of
multiple ``*`` pattern characters.  This was repaired by generating more
elaborate regular expressions to avoid futile backtracking.

..

.. bpo: 40495
.. date: 2020-05-04-11-20-49
.. nonce: TyTc2O
.. section: Library

:mod:`compileall` is now able to use hardlinks to prevent duplicates in a
case when ``.pyc`` files for different optimization levels have the same
content.

..

.. bpo: 40457
.. date: 2020-05-02-17-17-37
.. nonce: EXReI1
.. section: Library

The ssl module now support OpenSSL builds without TLS 1.0 and 1.1 methods.

..

.. bpo: 40355
.. date: 2020-05-02-14-24-48
.. nonce: xTujaB
.. section: Library

Improve error reporting in :func:`ast.literal_eval` in the presence of
malformed :class:`ast.Dict` nodes instead of silently ignoring any
non-conforming elements. Patch by Curtis Bucher.

..

.. bpo: 40465
.. date: 2020-05-02-12-00-28
.. nonce: qfCjOD
.. section: Library

Deprecated the optional *random* argument to *random.shuffle()*.

..

.. bpo: 40459
.. date: 2020-05-02-04-29-31
.. nonce: fSAYVD
.. section: Library

:func:`platform.win32_ver` now produces correct *ptype* strings instead of
empty strings.

..

.. bpo: 39435
.. date: 2020-05-01-23-24-25
.. nonce: mgb6ib
.. section: Library

The first argument of :func:`pickle.loads` is now positional-only.

..

.. bpo: 39305
.. date: 2020-05-01-00-22-58
.. nonce: Cuwu_H
.. section: Library

Update :mod:`nntplib` to merge :class:`nntplib.NNTP` and
:class:`nntplib._NNTPBase`. Patch by Dong-hee Na.

..

.. bpo: 32494
.. date: 2020-04-30-22-25-08
.. nonce: 1xaU5l
.. section: Library

Update :mod:`dbm.gnu` to use gdbm_count if possible when calling
:func:`len`. Patch by Dong-hee Na.

..

.. bpo: 40453
.. date: 2020-04-30-22-04-58
.. nonce: ggz7sl
.. section: Library

Add ``isolated=True`` keyword-only parameter to
``_xxsubinterpreters.create()``. An isolated subinterpreter cannot spawn
threads, spawn a child process or call ``os.fork()``.

..

.. bpo: 40286
.. date: 2020-04-29-18-02-16
.. nonce: txbQNx
.. section: Library

Remove ``_random.Random.randbytes()``: the C implementation of
``randbytes()``. Implement the method in Python to ease subclassing:
``randbytes()`` now directly reuses ``getrandbits()``.

..

.. bpo: 40394
.. date: 2020-04-28-18-59-48
.. nonce: Yi5uuM
.. section: Library

Added default arguments to
:meth:`difflib.SequenceMatcher.find_longest_match()`.

..

.. bpo: 39995
.. date: 2020-04-28-18-25-27
.. nonce: WmA3Gk
.. section: Library

Fix a race condition in concurrent.futures._ThreadWakeup: access to
_ThreadWakeup is now protected with the shutdown lock.

..

.. bpo: 30966
.. date: 2020-04-27-20-27-39
.. nonce: Xmtlqu
.. section: Library

``Process.shutdown(wait=True)`` of :mod:`concurrent.futures` now closes
explicitly the result queue.

..

.. bpo: 30966
.. date: 2020-04-27-17-19-09
.. nonce: _5lDx-
.. section: Library

Add a new :meth:`~multiprocessing.SimpleQueue.close` method to the
:class:`~multiprocessing.SimpleQueue` class to explicitly close the queue.

..

.. bpo: 39966
.. date: 2020-04-27-14-48-43
.. nonce: N5yXUe
.. section: Library

Revert bpo-25597. :class:`unittest.mock.MagicMock` with wraps' set uses
default return values for magic methods.

..

.. bpo: 39791
.. date: 2020-04-27-00-51-40
.. nonce: wv8Dxn
.. section: Library

Added ``files()`` function to importlib.resources with support for
subdirectories in package data, matching backport in importlib_resources
1.5.

..

.. bpo: 40375
.. date: 2020-04-25-23-14-11
.. nonce: 5GuK2A
.. section: Library

:meth:`imaplib.IMAP4.unselect` is added. Patch by Dong-hee Na.

..

.. bpo: 40389
.. date: 2020-04-25-20-00-58
.. nonce: FPA6f0
.. section: Library

``repr()`` now returns ``typing.Optional[T]`` when called for
``typing.Union`` of two types, one of which is ``NoneType``.

..

.. bpo: 40291
.. date: 2020-04-14-22-31-27
.. nonce: _O8hXn
.. section: Library

Add support for CAN_J1939 sockets (available on Linux 5.4+)

..

.. bpo: 40273
.. date: 2020-04-14-09-54-35
.. nonce: IN73Ks
.. section: Library

:class:`types.MappingProxyType` is now reversible.

..

.. bpo: 39075
.. date: 2020-04-07-23-44-06
.. nonce: hgck3j
.. section: Library

The repr for :class:`types.SimpleNamespace` is now insertion ordered rather
than alphabetical.

..

.. bpo: 40192
.. date: 2020-04-05-04-16-14
.. nonce: nk8uRJ
.. section: Library

On AIX, :func:`~time.thread_time` is now implemented with
``thread_cputime()`` which has nanosecond resolution, rather than
``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` which has a resolution of 10 milliseconds.
Patch by Batuhan Taskaya.

..

.. bpo: 40025
.. date: 2020-03-21-05-26-38
.. nonce: DTLtyq
.. section: Library

Raise TypeError when _generate_next_value_ is defined after members. Patch
by Ethan Onstott.

..

.. bpo: 39058
.. date: 2019-12-15-19-17-10
.. nonce: 7ci-vd
.. section: Library

In the argparse module, the repr for Namespace() and other argument holders
now displayed in the order attributes were added.  Formerly, it displayed in
alphabetical order even though argument order is preserved the user visible
parts of the module.

..

.. bpo: 24416
.. date: 2019-09-01-15-17-49
.. nonce: G8Ww1U
.. section: Library

The ``isocalendar()`` methods of :class:`datetime.date` and
:class:`datetime.datetime` now return a :term:`named tuple` instead of a
:class:`tuple`.

..

.. bpo: 34790
.. date: 2020-05-08-20-18-55
.. nonce: t6kW_1
.. section: Documentation

Add version of removal for explicit passing of coros to `asyncio.wait()`'s
documentation

..

.. bpo: 40561
.. date: 2020-05-08-08-39-40
.. nonce: ZMB_2i
.. section: Documentation

Provide docstrings for webbrowser open functions.

..

.. bpo: 40499
.. date: 2020-05-04-14-20-02
.. nonce: tjLSo8
.. section: Documentation

Mention that :func:`asyncio.wait` requires a non-empty set of awaitables.

..

.. bpo: 39705
.. date: 2020-03-14-18-37-06
.. nonce: nQVqig
.. section: Documentation

Tutorial example for sorted() in the Loop Techniques section is given a
better explanation. Also a new example is included to explain sorted()'s
basic behavior.

..

.. bpo: 39435
.. date: 2020-01-24-05-42-57
.. nonce: EFcdFU
.. section: Documentation

Fix an incorrect signature for :func:`pickle.loads` in the docs

..

.. bpo: 40055
.. date: 2020-05-15-01-21-44
.. nonce: Xp4aP9
.. section: Tests

distutils.tests now saves/restores warnings filters to leave them unchanged.
Importing tests imports docutils which imports pkg_resources which adds a
warnings filter.

..

.. bpo: 40436
.. date: 2020-04-29-16-08-24
.. nonce: gDMnYl
.. section: Tests

test_gdb and test.pythoninfo now check gdb command exit code.

..

.. bpo: 40653
.. date: 2020-05-17-03-33-00
.. nonce: WI8UGn
.. section: Build

Move _dirnameW out of HAVE_SYMLINK to fix a potential compiling issue.

..

.. bpo: 40514
.. date: 2020-05-05-15-39-11
.. nonce: bZZmuS
.. section: Build

Add ``--with-experimental-isolated-subinterpreters`` build option to
``configure``: better isolate subinterpreters, experimental build mode.

..

.. bpo: 40650
.. date: 2020-05-17-00-08-13
.. nonce: 4euMtU
.. section: Windows

Include winsock2.h in pytime.c for timeval.

..

.. bpo: 40458
.. date: 2020-05-01-20-57-57
.. nonce: Eb0ueI
.. section: Windows

Increase reserved stack space to prevent overflow crash on Windows.

..

.. bpo: 39148
.. date: 2020-03-23-19-07-55
.. nonce: W1YJEb
.. section: Windows

Add IPv6 support to :mod:`asyncio` datagram endpoints in ProactorEventLoop.
Change the raised exception for unknown address families to ValueError as
it's not coming from Windows API.

..

.. bpo: 34956
.. date: 2020-05-18-02-43-11
.. nonce: 35IcGF
.. section: macOS

When building Python on macOS from source, ``_tkinter`` now links with
non-system Tcl and Tk frameworks if they are installed in
``/Library/Frameworks``, as had been the case on older releases
of macOS. If a macOS SDK is explicitly configured, by using
``--enable-universalsdk=`` or ``-isysroot``, only the SDK itself is
searched. The default behavior can still be overridden with
``--with-tcltk-includes`` and ``--with-tcltk-libs``.

..

.. bpo: 35569
.. date: 2020-04-15-00-02-47
.. nonce: 02_1MV
.. section: macOS

Expose RFC 3542 IPv6 socket options.

..

.. bpo: 40479
.. date: 2020-05-15-17-48-25
.. nonce: B1gBl-
.. section: Tools/Demos

Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1,
and 3.0.0-alpha.

..

.. bpo: 40431
.. date: 2020-04-29-01-32-17
.. nonce: B_aEZ0
.. section: Tools/Demos

Fix a syntax typo in ``turtledemo`` that now raises a ``SyntaxError``.

..

.. bpo: 40163
.. date: 2020-04-03-08-32-31
.. nonce: lX8K4B
.. section: Tools/Demos

Fix multissltest tool. OpenSSL has changed download URL for old releases.
The multissltest tool now tries to download from current and old download
URLs.

..

.. bpo: 39465
.. date: 2020-05-14-00-36-19
.. nonce: 3a5g-X
.. section: C API

Remove the ``_PyUnicode_ClearStaticStrings()`` function from the C API.

..

.. bpo: 38787
.. date: 2020-05-10-16-39-08
.. nonce: XzQ59O
.. section: C API

Add PyCFunction_CheckExact() macro for exact type checks now that we allow
subtypes of PyCFunction, as well as PyCMethod_CheckExact() and
PyCMethod_Check() for the new PyCMethod subtype.

..

.. bpo: 40545
.. date: 2020-05-07-11-41-13
.. nonce: 51DzF1
.. section: C API

Declare ``_PyErr_GetTopmostException()`` with ``PyAPI_FUNC()`` to properly
export the function in the C API. The function remains private (``_Py``)
prefix.

..

.. bpo: 40412
.. date: 2020-05-01-17-28-04
.. nonce: dE0D8N
.. section: C API

Nullify inittab_copy during finalization, preventing future interpreter
initializations in an embedded situation from crashing. Patch by Gregory
Szorc.

..

.. bpo: 40429
.. date: 2020-04-29-01-39-41
.. nonce: VQfvta
.. section: C API

The :c:func:`PyThreadState_GetFrame` function now returns a strong reference
to the frame.

..

.. bpo: 40428
.. date: 2020-04-28-23-17-27
.. nonce: rmtpru
.. section: C API

Remove the following functions from the C API. Call :c:func:`PyGC_Collect`
explicitly to free all free lists.

* ``PyAsyncGen_ClearFreeLists()``
* ``PyContext_ClearFreeList()``
* ``PyDict_ClearFreeList()``
* ``PyFloat_ClearFreeList()``
* ``PyFrame_ClearFreeList()``
* ``PyList_ClearFreeList()``
* ``PySet_ClearFreeList()``
* ``PyTuple_ClearFreeList()``

..

.. bpo: 40421
.. date: 2020-04-28-19-29-36
.. nonce: 3uIIaB
.. section: C API

New :c:func:`PyFrame_GetBack` function: get the frame next outer frame.

..

.. bpo: 40421
.. date: 2020-04-28-15-47-58
.. nonce: ZIzOV0
.. section: C API

New :c:func:`PyFrame_GetCode` function: return a borrowed reference to the
frame code.

..

.. bpo: 40217
.. date: 2020-04-27-14-00-38
.. nonce: sgn6c8
.. section: C API

Ensure that instances of types created with
:c:func:`PyType_FromSpecWithBases` will visit its class object when
traversing references in the garbage collector (implemented as an extension
of the provided :c:member:`~PyTypeObject.tp_traverse`). Patch by Pablo
Galindo.

..

.. bpo: 38787
.. date: 2020-01-22-12-38-59
.. nonce: HUH6hd
.. section: C API

Module C state is now accessible from C-defined heap type methods
(:pep:`573`). Patch by Marcel Plch and Petr Viktorin.
