.. bpo: 47212
.. date: 2022-04-05-11-29-21
.. nonce: leF4pz
.. release date: 2022-04-05
.. section: Core and Builtins

Raise :exc:`IndentationError` instead of :exc:`SyntaxError` for a bare
``except`` with no following indent. Improve :exc:`SyntaxError` locations
for an un-parenthesized generator used as arguments. Patch by Matthieu
Dartiailh.

..

.. bpo: 47186
.. date: 2022-04-04-17-41-10
.. nonce: aQWoSh
.. section: Core and Builtins

Replace :opcode:`JUMP_IF_NOT_EG_MATCH` by :opcode:`CHECK_EG_MATCH` + jump.

..

.. bpo: 47176
.. date: 2022-04-02-14-32-21
.. nonce: kTygYI
.. section: Core and Builtins

Emscripten builds cannot handle signals in the usual way due to platform
limitations. Python can now handle signals. To use, set
Module.Py_EmscriptenSignalBuffer to be a single byte SharedArrayBuffer and
set Py_EMSCRIPTEN_SIGNAL_HANDLING to 1. Writing a number into the
SharedArrayBuffer will cause the corresponding signal to be raised into the
Python thread.

..

.. bpo: 47186
.. date: 2022-04-01-11-53-59
.. nonce: RBCPk8
.. section: Core and Builtins

Replace :opcode:`JUMP_IF_NOT_EXC_MATCH` by :opcode:`CHECK_EXC_MATCH` + jump.

..

.. bpo: 47120
.. date: 2022-03-31-21-43-57
.. nonce: NgxQbA
.. section: Core and Builtins

Replace the absolute jump opcode :opcode:`JUMP_NO_INTERRUPT` by the relative
:opcode:`JUMP_BACKWARD_NO_INTERRUPT`.

..

.. bpo: 46841
.. date: 2022-03-31-15-57-42
.. nonce: U-25Z6
.. section: Core and Builtins

Avoid unnecessary allocations when comparing code objects.

..

.. bpo: 47182
.. date: 2022-03-31-15-37-02
.. nonce: e_4SsC
.. section: Core and Builtins

Fix a crash when using a named unicode character like ``"\N{digit nine}"``
after the main interpreter has been initialized a second time.

..

.. bpo: 47162
.. date: 2022-03-30-13-13-25
.. nonce: yDJMUm
.. section: Core and Builtins

WebAssembly cannot deal with bad function pointer casts (different count or
types of arguments). Python can now use call trampolines to mitigate the
problem. Define :c:macro:`PY_CALL_TRAMPOLINE` to enable call trampolines.

..

.. bpo: 46775
.. date: 2022-03-30-02-36-25
.. nonce: e3Oxqf
.. section: Core and Builtins

Some Windows system error codes(>= 10000) are now mapped into the correct
errno and may now raise a subclass of :exc:`OSError`. Patch by Donghee Na.

..

.. bpo: 47129
.. date: 2022-03-26-16-35-57
.. nonce: hDg2Vt
.. section: Core and Builtins

Improve error messages in f-string syntax errors concerning empty
expressions.

..

.. bpo: 47117
.. date: 2022-03-26-15-45-57
.. nonce: 60W6GQ
.. section: Core and Builtins

Fix a crash if we fail to decode characters in interactive mode if the
tokenizer buffers are uninitialized. Patch by Pablo Galindo.

..

.. bpo: 47127
.. date: 2022-03-26-12-21-53
.. nonce: Mh86RB
.. section: Core and Builtins

Speed up calls to c functions with keyword arguments by 25% with
specialization. Patch by Kumar Aditya.

..

.. bpo: 47120
.. date: 2022-03-25-21-51-10
.. nonce: 9YJ-Xw
.. section: Core and Builtins

Replaced :opcode:`JUMP_ABSOLUTE` by the relative jump
:opcode:`JUMP_BACKWARD`.

..

.. bpo: 42197
.. date: 2022-03-22-15-12-28
.. nonce: SwrrFO
.. section: Core and Builtins

:c:func:`!PyFrame_FastToLocalsWithError` and :c:func:`!PyFrame_LocalsToFast`
are no longer called during profiling nor tracing. C code can access the
``f_locals`` attribute of :c:type:`PyFrameObject` by calling
:c:func:`PyFrame_GetLocals`.

..

.. bpo: 47070
.. date: 2022-03-19-21-50-59
.. nonce: wPcsQh
.. section: Core and Builtins

Improve performance of ``array_inplace_repeat`` by reducing the number of
invocations of ``memcpy``. Refactor the ``repeat`` and inplace ``repeat``
methods of ``array``, ``bytes``, ``bytearray`` and ``unicodeobject`` to use
the common ``_PyBytes_Repeat``.

..

.. bpo: 47053
.. date: 2022-03-17-22-47-29
.. nonce: QAXk8Q
.. section: Core and Builtins

Reduce de-optimization in the specialized ``BINARY_OP_INPLACE_ADD_UNICODE``
opcode.

..

.. bpo: 47045
.. date: 2022-03-17-16-25-57
.. nonce: xQgHul
.. section: Core and Builtins

Remove the ``f_state`` field from the _PyInterpreterFrame struct. Add the
``owner`` field to the _PyInterpreterFrame struct to make ownership explicit
to simplify clearing and deallocing frames and generators.

..

.. bpo: 46968
.. date: 2022-03-17-14-22-23
.. nonce: 4gz4NA
.. section: Library

Check for the existence of the "sys/auxv.h" header in :mod:`faulthandler` to
avoid compilation problems in systems where this header doesn't exist. Patch
by Pablo Galindo

..

.. bpo: 46329
.. date: 2022-03-16-12-19-25
.. nonce: 9oS0HT
.. section: Core and Builtins

Use low bit of ``LOAD_GLOBAL`` to indicate whether to push a ``NULL`` before
the global. Helps streamline the call sequence a bit.

..

.. bpo: 46841
.. date: 2022-03-16-11-05-35
.. nonce: yUoIHg
.. section: Core and Builtins

Quicken bytecode in-place by storing it as part of the corresponding
``PyCodeObject``.

..

.. bpo: 47012
.. date: 2022-03-14-11-15-11
.. nonce: 5L6NoE
.. section: Core and Builtins

Speed up iteration of :class:`bytes` and :class:`bytearray` by 30%. Patch by
Kumar Aditya.

..

.. bpo: 47009
.. date: 2022-03-14-09-45-10
.. nonce: ZI05b5
.. section: Core and Builtins

Improved the performance of :meth:`list.append` and list comprehensions by
optimizing for the common case, where no resize is needed. Patch by Dennis
Sweeney.

..

.. bpo: 47005
.. date: 2022-03-13-21-04-20
.. nonce: OHBfCc
.. section: Core and Builtins

Improve performance of ``bytearray_repeat`` and ``bytearray_irepeat`` by
reducing the number of invocations of ``memcpy``.

..

.. bpo: 46829
.. date: 2022-03-12-21-07-21
.. nonce: cpGoPV
.. section: Library

Deprecate passing a message into :meth:`asyncio.Future.cancel` and
:meth:`asyncio.Task.cancel`

..

.. bpo: 46993
.. date: 2022-03-12-09-44-31
.. nonce: -13hGo
.. section: Core and Builtins

Speed up :class:`bytearray` creation from :class:`list` and :class:`tuple`
by 40%. Patch by Kumar Aditya.

..

.. bpo: 39829
.. date: 2022-03-11-09-39-01
.. nonce: mlW3Su
.. section: Core and Builtins

Removed the ``__len__()`` call when initializing a list and moved
initializing to ``list_extend``. Patch by Jeremiah Pascual.

..

.. bpo: 46944
.. date: 2022-03-08-10-50-42
.. nonce: cnaIK3
.. section: Core and Builtins

Speed up throwing exception in generator with :c:macro:`METH_FASTCALL` calling
convention. Patch by Kumar Aditya.

..

.. bpo: 46841
.. date: 2022-03-07-15-54-39
.. nonce: 7wG92r
.. section: Core and Builtins

Modify :opcode:`STORE_SUBSCR` to use an inline cache entry (rather than its
oparg) as an adaptive counter.

..

.. bpo: 46841
.. date: 2022-03-06-10-37-36
.. nonce: O12Pba
.. section: Core and Builtins

Use inline caching for :opcode:`!PRECALL` and :opcode:`CALL`, and remove the
internal machinery for managing the (now unused) non-inline caches.

..

.. bpo: 46881
.. date: 2022-03-03-09-08-17
.. nonce: ckD4tT
.. section: Core and Builtins

Statically allocate and initialize the latin1 characters.

..

.. bpo: 46838
.. date: 2022-02-25-22-42-30
.. nonce: RB6kEy
.. section: Core and Builtins

Improve syntax errors for incorrect function definitions. Patch by Pablo
Galindo

..

.. bpo: 43721
.. date: 2022-02-01-10-05-27
.. nonce: -1XAIo
.. section: Core and Builtins

Fix docstrings of :attr:`~property.getter`, :attr:`~property.setter`, and
:attr:`~property.deleter` to clarify that they create a new copy of the
property.

..

.. bpo: 43224
.. date: 2022-01-20-16-48-09
.. nonce: WDihrT
.. section: Core and Builtins

Make grammar changes required for PEP 646.

..

.. bpo: 47208
.. date: 2022-04-04-08-54-31
.. nonce: cOh9xZ
.. section: Library

Allow vendors to override :const:`CTYPES_MAX_ARGCOUNT`.

..

.. bpo: 23689
.. date: 2022-04-03-13-19-08
.. nonce: TFSc3E
.. section: Library

:mod:`re` module: fix memory leak when a match is terminated by a signal or
memory allocation failure. Patch by Ma Lin.

..

.. bpo: 47167
.. date: 2022-03-30-18-35-50
.. nonce: nCNHsB
.. section: Library

Allow overriding a future compliance check in :class:`asyncio.Task`.

..

.. bpo: 47151
.. date: 2022-03-30-01-17-43
.. nonce: z-nQkR
.. section: Library

When subprocess tries to use vfork, it now falls back to fork if vfork
returns an error. This allows use in situations where vfork isn't allowed by
the OS kernel.

..

.. bpo: 47152
.. date: 2022-03-29-19-14-53
.. nonce: 5rl5ZK
.. section: Library

Convert the :mod:`re` module into a package. Deprecate modules
``sre_compile``, ``sre_constants`` and ``sre_parse``.

..

.. bpo: 4833
.. date: 2022-03-28-20-16-37
.. nonce: 2vSUE5
.. section: Library

Add :meth:`ZipFile.mkdir`

..

.. bpo: 27929
.. date: 2022-03-28-13-35-50
.. nonce: j5mAmV
.. section: Library

Fix :meth:`asyncio.loop.sock_connect` to only resolve names for
:const:`socket.AF_INET` or :const:`socket.AF_INET6` families. Resolution may
not make sense for other families, like :const:`socket.AF_BLUETOOTH` and
:const:`socket.AF_UNIX`.

..

.. bpo: 14265
.. date: 2022-03-27-10-41-24
.. nonce: OBMlAi
.. section: Library

Adds the fully qualified test name to unittest output

..

.. bpo: 47061
.. date: 2022-03-26-13-14-43
.. nonce: QLxbC6
.. section: Library

Deprecate the aifc module.

..

.. bpo: 39622
.. date: 2022-03-25-01-27-25
.. nonce: ieBIMp
.. section: Library

Handle Ctrl+C in asyncio programs to interrupt the main task.

..

.. bpo: 47101
.. date: 2022-03-23-15-31-02
.. nonce: rVSld-
.. section: Library

:const:`hashlib.algorithms_available` now lists only algorithms that are
provided by activated crypto providers on OpenSSL 3.0. Legacy algorithms are
not listed unless the legacy provider has been loaded into the default OSSL
context.

..

.. bpo: 47099
.. date: 2022-03-23-14-16-38
.. nonce: 2raait
.. section: Library

All :exc:`URLError` exception messages raised in
:class:`urllib.request.URLopener` now contain a colon between ``ftp error``
and the rest of the message. Previously,
:func:`~urllib.request.URLopener.open_ftp` missed the colon. Patch by Oleg
Iarygin.

..

.. bpo: 47099
.. date: 2022-03-23-13-55-41
.. nonce: P6quRP
.. section: Library

Exception chaining is changed from
:func:`Exception.with_traceback`/:func:`sys.exc_info` to :pep:`3134`. Patch
by Oleg Iarygin.

..

.. bpo: 47095
.. date: 2022-03-23-12-07-26
.. nonce: P3YTrh
.. section: Library

:mod:`hashlib`'s internal ``_blake2`` module now prefers ``libb2`` from
https://www.blake2.net/ over Python's vendored copy of blake2.

..

.. bpo: 47098
.. date: 2022-03-23-10-07-41
.. nonce: 7AN_qp
.. section: Library

The Keccak Code Package for :mod:`hashlib`'s internal ``_sha3`` module has
been replaced with tiny_sha3. The module is used as fallback when Python is
built without OpenSSL.

..

.. bpo: 47088
.. date: 2022-03-22-19-18-31
.. nonce: JM1kNI
.. section: Library

Implement :data:`typing.LiteralString`, part of :pep:`675`. Patch by Jelle
Zijlstra.

..

.. bpo: 42885
.. date: 2022-03-21-08-32-19
.. nonce: LCnTTp
.. section: Library

Optimize :func:`re.search`, :func:`re.split`, :func:`re.findall`,
:func:`re.finditer` and :func:`re.sub` for regular expressions starting with
``\A`` or ``^``.

..

.. bpo: 23691
.. date: 2022-03-20-22-13-24
.. nonce: Nc2TrW
.. section: Library

Protect the :func:`re.finditer` iterator from re-entering.

..

.. bpo: 47067
.. date: 2022-03-20-17-15-56
.. nonce: XXLnje
.. section: Library

Optimize calling ``GenericAlias`` objects by using :pep:`590` ``vectorcall``
and by replacing ``PyObject_SetAttrString`` with ``PyObject_SetAttr``.

..

.. bpo: 28080
.. date: 2022-03-20-15-54-41
.. nonce: kn35Vk
.. section: Library

Add the *metadata_encoding* parameter in the :class:`zipfile.ZipFile`
constructor and the ``--metadata-encoding`` option in the :mod:`zipfile` CLI
to allow reading zipfiles using non-standard codecs to encode the filenames
within the archive.

..

.. bpo: 47000
.. date: 2022-03-20-13-00-08
.. nonce: p8HpG0
.. section: Library

Make :func:`io.text_encoding` returns "utf-8" when UTF-8 mode is enabled.

..

.. bpo: 42369
.. date: 2022-03-19-19-56-04
.. nonce: Ok828t
.. section: Library

Fix thread safety of :meth:`zipfile._SharedFile.tell` to avoid a
"zipfile.BadZipFile: Bad CRC-32 for file" exception when reading a
:class:`ZipFile` from multiple threads.

..

.. bpo: 38256
.. date: 2022-03-19-15-54-41
.. nonce: FoMbjE
.. section: Library

Fix :func:`binascii.crc32` when it is compiled to use zlib'c crc32 to work
properly on inputs 4+GiB in length instead of returning the wrong result.
The workaround prior to this was to always feed the function data in
increments smaller than 4GiB or to just call the zlib module function.

We also have :func:`binascii.crc32` release the GIL when computing on larger
inputs as :func:`zlib.crc32` and :mod:`hashlib` do.

This also boosts performance on Windows as it now uses the zlib crc32
implementation for :func:`binascii.crc32` for a 2-3x speedup.

That the stdlib has a crc32 API in two modules is a known historical oddity.
This moves us closer to a single implementation behind them.

..

.. bpo: 47066
.. date: 2022-03-19-14-12-23
.. nonce: we3YFx
.. section: Library

Global inline flags (e.g. ``(?i)``) can now only be used at the start of the
regular expressions.  Using them not at the start of expression was
deprecated since Python 3.6.

..

.. bpo: 39394
.. date: 2022-03-19-13-38-29
.. nonce: 7j6WL6
.. section: Library

A warning about inline flags not at the start of the regular expression now
contains the position of the flag.

..

.. bpo: 433030
.. date: 2022-03-19-08-42-57
.. nonce: UTwRX7
.. section: Library

Add support of atomic grouping (``(?>...)``) and possessive quantifiers
(``*+``, ``++``, ``?+``, ``{m,n}+``) in :mod:`regular expressions <re>`.

..

.. bpo: 47062
.. date: 2022-03-18-22-46-18
.. nonce: RNc99_
.. section: Library

Implement :class:`asyncio.Runner` context manager.

..

.. bpo: 46382
.. date: 2022-03-18-17-25-57
.. nonce: zQUJ66
.. section: Library

:func:`~dataclasses.dataclass` ``slots=True`` now correctly omits slots
already defined in base classes. Patch by Arie Bovenberg.

..

.. bpo: 47057
.. date: 2022-03-18-14-22-38
.. nonce: n-IHbt
.. section: Library

Use FASTCALL convention for ``FutureIter.throw()``

..

.. bpo: 47061
.. date: 2022-03-18-13-30-40
.. nonce: etLHK5
.. section: Library

Deprecate the various modules listed by :pep:`594`:

aifc, asynchat, asyncore, audioop, cgi, cgitb, chunk, crypt, imghdr, msilib,
nntplib, nis, ossaudiodev, pipes, smtpd, sndhdr, spwd, sunau, telnetlib, uu,
xdrlib

..

.. bpo: 34790
.. date: 2022-03-17-19-38-40
.. nonce: zQIiVJ
.. section: Library

Remove passing coroutine objects to :func:`asyncio.wait`.

..

.. bpo: 47039
.. date: 2022-03-17-01-54-13
.. nonce: 0Yxv0K
.. section: Library

Normalize ``repr()`` of asyncio future and task objects.

..

.. bpo: 2604
.. date: 2022-03-16-18-25-19
.. nonce: jeopdL
.. section: Library

Fix bug where doctests using globals would fail when run multiple times.

..

.. bpo: 45150
.. date: 2022-03-16-11-52-52
.. nonce: kYbIME
.. section: Library

Add :func:`hashlib.file_digest` helper for efficient hashing of file object.

..

.. bpo: 34861
.. date: 2022-03-16-08-49-12
.. nonce: p8ugVg
.. section: Library

Made cumtime the default sorting key for cProfile

..

.. bpo: 45997
.. date: 2022-03-15-18-32-12
.. nonce: 4n2aVU
.. section: Library

Fix :class:`asyncio.Semaphore` re-aquiring FIFO order.

..

.. bpo: 47022
.. date: 2022-03-15-09-29-52
.. nonce: uaEDcI
.. section: Library

The :mod:`!asynchat`, :mod:`!asyncore` and  :mod:`!smtpd` modules have been
deprecated since at least Python 3.6. Their documentation and deprecation
warnings and have now been updated to note they will removed in Python 3.12
(:pep:`594`).

..

.. bpo: 43253
.. date: 2022-03-15-07-53-45
.. nonce: rjdLFj
.. section: Library

Fix a crash when closing transports where the underlying socket handle is
already invalid on the Proactor event loop.

..

.. bpo: 40280
.. date: 2022-03-14-09-26-42
.. nonce: 2-k8TV
.. section: Library

:func:`select.select` now passes ``NULL`` to ``select`` for each empty
fdset.

..

.. bpo: 47004
.. date: 2022-03-13-15-04-05
.. nonce: SyYpxd
.. section: Library

Apply bugfixes from importlib_metadata 4.11.3, including bugfix for
EntryPoint.extras, which was returning match objects and not the extras
strings.

..

.. bpo: 46998
.. date: 2022-03-13-08-52-58
.. nonce: cHh-9O
.. section: Library

Allow subclassing of :class:`typing.Any`. Patch by Shantanu Jain.

..

.. bpo: 46995
.. date: 2022-03-12-13-50-42
.. nonce: 2kdNDg
.. section: Library

Deprecate missing :meth:`asyncio.Task.set_name` for third-party task
implementations, schedule making it mandatory in Python 3.13.

..

.. bpo: 46994
.. date: 2022-03-12-12-34-13
.. nonce: d7hPdz
.. section: Library

Accept explicit contextvars.Context in :func:`asyncio.create_task` and
:meth:`asyncio.loop.create_task`.

..

.. bpo: 46981
.. date: 2022-03-12-11-30-42
.. nonce: ltWCxH
.. section: Library

``typing.get_args(typing.Tuple[()])`` now returns ``()`` instead of
``((),)``.

..

.. bpo: 46968
.. date: 2022-03-11-17-56-25
.. nonce: pPVvNo
.. section: Library

Add ``os.sysconf_names['SC_MINSIGSTKSZ']``.

..

.. bpo: 46985
.. date: 2022-03-11-13-34-16
.. nonce: BgoMr2
.. section: Library

Upgrade pip wheel bundled with ensurepip (pip 22.0.4)

..

.. bpo: 46968
.. date: 2022-03-10-14-51-11
.. nonce: ym2QxL
.. section: Library

:mod:`faulthandler`: On Linux 5.14 and newer, dynamically determine size of
signal handler stack size CPython allocates using
``getauxval(AT_MINSIGSTKSZ)``. This changes allows for Python extension's
request to Linux kernel to use AMX_TILE instruction set on Sapphire Rapids
Xeon processor to succeed, unblocking use of the ISA in frameworks.

..

.. bpo: 46917
.. date: 2022-03-10-14-47-16
.. nonce: s19zcy
.. section: Library

The :data:`math.nan` value is now always available. Patch by Victor Stinner.

..

.. bpo: 46955
.. date: 2022-03-08-22-41-59
.. nonce: IOoonN
.. section: Library

Expose :class:`asyncio.base_events.Server` as :class:`asyncio.Server`. Patch
by Stefan Zabka.

..

.. bpo: 23325
.. date: 2022-03-08-11-34-06
.. nonce: 3VQnfo
.. section: Library

The :mod:`signal` module no longer assumes that :const:`~signal.SIG_IGN` and
:const:`~signal.SIG_DFL` are small int singletons.

..

.. bpo: 46932
.. date: 2022-03-07-20-20-34
.. nonce: xbarAs
.. section: Library

Update bundled libexpat to 2.4.7

..

.. bpo: 46933
.. date: 2022-03-05-21-51-31
.. nonce: 6yzWtb
.. section: Library

The :mod:`pwd` module is now optional. :func:`os.path.expanduser` returns
the path when the :mod:`pwd` module is not available.

..

.. bpo: 40059
.. date: 2022-02-23-01-11-08
.. nonce: Iwc9UH
.. section: Library

:pep:`680`, the :mod:`tomllib` module. Adds support for parsing TOML.

..

.. bpo: 464471
.. date: 2022-02-21-11-41-23
.. nonce: fL06TV
.. section: Library

:func:`asyncio.timeout` and :func:`asyncio.timeout_at` context managers
added. Patch by Tin Tvrtković and Andrew Svetlov.

..

.. bpo: 46805
.. date: 2022-02-20-23-03-32
.. nonce: HZ8xWG
.. section: Library

Added raw datagram socket functions for asyncio:
:meth:`~asyncio.AbstractEventLoop.sock_sendto`,
:meth:`~asyncio.AbstractEventLoop.sock_recvfrom` and
:meth:`~asyncio.AbstractEventLoop.sock_recvfrom_into`.

..

.. bpo: 46644
.. date: 2022-02-05-22-14-44
.. nonce: P--1Cz
.. section: Library

No longer require valid typeforms to be callable. This allows
:data:`typing.Annotated` to wrap :data:`typing.ParamSpecArgs` and
:data:`dataclasses.InitVar`. Patch by Gregory Beauregard.

..

.. bpo: 46581
.. date: 2022-02-01-11-32-47
.. nonce: t7Zw65
.. section: Library

Brings :class:`ParamSpec` propagation for :class:`GenericAlias` in line with
:class:`Concatenate` (and others).

..

.. bpo: 45413
.. date: 2022-01-31-15-19-38
.. nonce: 1vaS0V
.. section: Library

Define *posix_venv* and *nt_venv* :ref:`sysconfig installation schemes
<installation_paths>` to be used for bootstrapping new virtual environments.
Add *venv* sysconfig installation scheme to get the appropriate one of the
above. The schemes are identical to the pre-existing *posix_prefix* and *nt*
install schemes. The :mod:`venv` module now uses the *venv* scheme to create
new virtual environments instead of hardcoding the paths depending only on
the platform. Downstream Python distributors customizing the *posix_prefix*
or *nt* install scheme in a way that is not compatible with the install
scheme used in virtual environments are encouraged not to customize the
*venv* schemes. When Python itself runs in a virtual environment,
:func:`sysconfig.get_default_scheme` and
:func:`sysconfig.get_preferred_scheme` with ``key="prefix"`` returns *venv*.

..

.. bpo: 43224
.. date: 2022-01-30-22-05-53
.. nonce: E-eT22
.. section: Library

Implement support for PEP 646 in typing.py.

..

.. bpo: 43224
.. date: 2022-01-30-20-32-40
.. nonce: zqrQsj
.. section: Library

Allow unpacking types.GenericAlias objects, e.g. ``*tuple[int, str]``.

..

.. bpo: 46557
.. date: 2022-01-28-01-23-25
.. nonce: XSbhyQ
.. section: Library

Warnings captured by the logging module are now logged without a format
string to prevent systems that group logs by the msg argument from grouping
captured warnings together.

..

.. bpo: 41370
.. date: 2022-01-27-11-54-16
.. nonce: gYxCPE
.. section: Library

:func:`typing.get_type_hints` now supports evaluating strings as forward
references in :ref:`PEP 585 generic aliases <types-genericalias>`.

..

.. bpo: 46607
.. date: 2022-01-26-18-30-34
.. nonce: xnhT4a
.. section: Library

Add :exc:`DeprecationWarning` to :class:`!LegacyInterpolation`, deprecated in
the docstring since Python 3.2. Will be removed in Python 3.13. Use
:class:`BasicInterpolation` or :class:`ExtendedInterpolation` instead.

..

.. bpo: 26120
.. date: 2022-01-25-15-45-04
.. nonce: YzrBMO
.. section: Library

:mod:`pydoc` now excludes __future__ imports from the module's data items.

..

.. bpo: 46480
.. date: 2022-01-23-16-33-07
.. nonce: E4jHlh
.. section: Library

Add :func:`typing.assert_type`. Patch by Jelle Zijlstra.

..

.. bpo: 46421
.. date: 2022-01-18-01-29-38
.. nonce: 9LdmNr
.. section: Library

Fix a unittest issue where if the command was invoked as ``python -m
unittest`` and the filename(s) began with a dot (.), a ``ValueError`` is
returned.

..

.. bpo: 46245
.. date: 2022-01-03-20-12-14
.. nonce: 3w4RlA
.. section: Library

Add optional parameter *dir_fd* in :func:`shutil.rmtree`.

..

.. bpo: 22859
.. date: 2021-12-29-19-37-49
.. nonce: AixHW7
.. section: Library

:meth:`!unittest.TestProgram.usageExit` is marked as deprecated,
to be removed in Python 3.13.

..

.. bpo: 46170
.. date: 2021-12-26-14-45-51
.. nonce: AQ7kSM
.. section: Library

Improve the error message when you try to subclass an instance of
:class:`typing.NewType`.

..

.. bpo: 40296
.. date: 2021-12-25-14-13-14
.. nonce: p0YVGB
.. section: Library

Fix supporting generic aliases in :mod:`pydoc`.

..

.. bpo: 20392
.. date: 2021-12-22-12-02-27
.. nonce: CLAFIp
.. section: Library

Fix inconsistency with uppercase file extensions in
:meth:`MimeTypes.guess_type`. Patch by Kumar Aditya.

..

.. bpo: 46030
.. date: 2021-12-10-07-07-47
.. nonce: UN349J
.. section: Library

Add ``LOCAL_CREDS``, ``LOCAL_CREDS_PERSISTENT`` and ``SCM_CREDS2`` FreeBSD
constants to the socket module.

..

.. bpo: 44439
.. date: 2021-11-08-20-27-41
.. nonce: I_8qro
.. section: Library

Fix ``.write()`` method of a member file in ``ZipFile``, when the input data
is an object that supports the buffer protocol, the file length may be
wrong.

..

.. bpo: 45171
.. date: 2021-09-11-16-06-54
.. nonce: ec597j
.. section: Library

Fix handling of the ``stacklevel`` argument to logging functions in the
:mod:`logging` module so that it is consistent across all logging functions
and, as advertised, similar to the ``stacklevel`` argument used in
:meth:`~warnings.warn`.

..

.. bpo: 24959
.. date: 2021-09-06-15-46-53
.. nonce: UVFgiO
.. section: Library

Fix bug where :mod:`unittest` sometimes drops frames from tracebacks of
exceptions raised in tests.

..

.. bpo: 44859
.. date: 2021-08-10-00-05-53
.. nonce: 9e9_3V
.. section: Library

Raise more accurate and :pep:`249` compatible exceptions in :mod:`sqlite3`.

* Raise :exc:`~sqlite3.InterfaceError` instead of
  :exc:`~sqlite3.ProgrammingError` for ``SQLITE_MISUSE`` errors.
* Don't overwrite :exc:`BufferError` with :exc:`ValueError` when conversion to
  BLOB fails.
* Raise :exc:`~sqlite3.ProgrammingError` instead of :exc:`~sqlite3.Warning` if
  user tries to :meth:`~sqlite3.Cursor.execute` more than one SQL statement.
* Raise :exc:`~sqlite3.ProgrammingError` instead of :exc:`ValueError` if an SQL
  query contains null characters.

..

.. bpo: 44493
.. date: 2021-07-26-10-46-49
.. nonce: xp3CRH
.. section: Library

Add missing terminated NUL in sockaddr_un's length

This was potentially observable when using non-abstract AF_UNIX datagram
sockets to processes written in another programming language.

..

.. bpo: 41930
.. date: 2021-06-17-00-02-58
.. nonce: JS6fsd
.. section: Library

Add :meth:`~sqlite3.Connection.serialize` and
:meth:`~sqlite3.Connection.deserialize` support to :mod:`sqlite3`. Patch by
Erlend E. Aasland.

..

.. bpo: 33178
.. date: 2021-04-20-16-48-07
.. nonce: kSnWwb
.. section: Library

Added :class:`ctypes.BigEndianUnion` and :class:`ctypes.LittleEndianUnion`
classes, as originally documented in the library docs but not yet
implemented.

..

.. bpo: 43352
.. date: 2021-03-31-15-22-45
.. nonce: nSjMuE
.. section: Library

Add an Barrier object in synchronization primitives of *asyncio* Lib in
order to be consistent with Barrier from *threading* and *multiprocessing*
libs*

..

.. bpo: 35859
.. date: 2019-03-14-09-08-25
.. nonce: 8lFdLe
.. section: Library

:mod:`re` module, fix a few bugs about capturing group. In rare cases,
capturing group gets an incorrect string. Patch by Ma Lin.

..

.. bpo: 45099
.. date: 2022-03-29-13-25-49
.. nonce: dagdhx
.. section: Documentation

Document internal :mod:`asyncio` API.

..

.. bpo: 47126
.. date: 2022-03-26-12-20-16
.. nonce: p6_Ovm
.. section: Documentation

Update PEP URLs to :pep:`676`'s new canonical form.

..

.. bpo: 47040
.. date: 2022-03-17-13-35-28
.. nonce: 4Dn48U
.. section: Documentation

Clarified the old Python versions compatibility note of
:func:`binascii.crc32` / :func:`zlib.adler32` / :func:`zlib.crc32`
functions.

..

.. bpo: 46033
.. date: 2022-01-03-18-50-39
.. nonce: 7WeF0f
.. section: Documentation

Clarify ``for`` statement execution in its doc.

..

.. bpo: 45790
.. date: 2021-11-12-11-03-55
.. nonce: 6yuhe8
.. section: Documentation

Adjust inaccurate phrasing in :doc:`../extending/newtypes_tutorial` about
the ``ob_base`` field and the macros used to access its contents.

..

.. bpo: 42340
.. date: 2020-11-12-21-26-31
.. nonce: apumUL
.. section: Documentation

Document that in some circumstances :exc:`KeyboardInterrupt` may cause the
code to enter an inconsistent state. Provided a sample workaround to avoid
it if needed.

..

.. bpo: 41233
.. date: 2020-07-07-22-54-51
.. nonce: lyUJ8L
.. section: Documentation

Link the errnos referenced in ``Doc/library/exceptions.rst`` to their
respective section in ``Doc/library/errno.rst``, and vice versa. Previously
this was only done for EINTR and InterruptedError. Patch by Yan "yyyyyyyan"
Orestes.

..

.. bpo: 47205
.. date: 2022-04-03-14-38-21
.. nonce: hbbTnh
.. section: Tests

Skip test for :func:`~os.sched_getaffinity` and
:func:`~os.sched_setaffinity` error case on FreeBSD.

..

.. bpo: 46126
.. date: 2022-03-26-11-41-19
.. nonce: q14Ioy
.. section: Tests

Restore 'descriptions' when running tests internally.

..

.. bpo: 47104
.. date: 2022-03-23-22-45-51
.. nonce: _esUq8
.. section: Tests

Rewrite :func:`asyncio.to_thread` tests to use
:class:`unittest.IsolatedAsyncioTestCase`.

..

.. bpo: 40280
.. date: 2022-03-19-10-25-04
.. nonce: wBRSel
.. section: Tests

The test suite is now passing on the Emscripten platform. All fork, socket,
and subprocess-based tests are skipped.

..

.. bpo: 47037
.. date: 2022-03-16-21-29-30
.. nonce: xcrLpJ
.. section: Tests

Skip ``strftime("%4Y")`` feature test on Windows. It can cause an assertion
error in debug builds.

..

.. bpo: 46587
.. date: 2022-03-14-17-10-35
.. nonce: ASDsJX
.. section: Tests

Skip tests if platform's ``strftime`` does not support non-portable glibc
extensions.

..

.. bpo: 47015
.. date: 2022-03-13-23-43-40
.. nonce: FjmCsz
.. section: Tests

A test case for :func:`os.sendfile` is converted from deprecated
:mod:`!asyncore` (see :pep:`594`) to :mod:`asyncio`. Patch by Oleg Iarygin.

..

.. bpo: 40280
.. date: 2022-04-02-17-52-38
.. nonce: U8Dd0H
.. section: Build

Add configure option :option:`--enable-wasm-dynamic-linking` to enable
``dlopen`` and MAIN_MODULE / SIDE_MODULE on ``wasm32-emscripten``.

..

.. bpo: 46023
.. date: 2022-04-01-16-12-53
.. nonce: 1Z1OcC
.. section: Build

``makesetup`` now detects and skips all duplicated module definitions. The
first entry wins.

..

.. bpo: 40280
.. date: 2022-03-24-12-12-35
.. nonce: eAQWrM
.. section: Build

Add SOABI ``wasm32-emscripten`` for Emscripten and ``wasm32-wasi`` for WASI
on 32bit WASM as well as ``wasm64`` counter parts.

..

.. bpo: 47032
.. date: 2022-03-16-00-37-40
.. nonce: tsS9KE
.. section: Build

Ensure Windows install builds fail correctly with a non-zero exit code when
part of the build fails.

..

.. bpo: 47024
.. date: 2022-03-15-09-28-55
.. nonce: t7-dcu
.. section: Build

Update OpenSSL to 1.1.1n for macOS installers and all Windows builds.

..

.. bpo: 46996
.. date: 2022-03-12-18-09-31
.. nonce: SygzVz
.. section: Build

The :mod:`tkinter` package now requires Tcl/Tk version 8.5.12 or newer.

..

.. bpo: 46973
.. date: 2022-03-10-14-30-39
.. nonce: _LEvnc
.. section: Build

Add ``regen-configure`` make target to regenerate configure script with
Christian's container image ``quay.io/tiran/cpython_autoconf:269``.

..

.. bpo: 46917
.. date: 2022-03-10-09-37-05
.. nonce: fry4aK
.. section: Build

Building Python now requires support of IEEE 754 floating-point numbers.
Patch by Victor Stinner.

..

.. bpo: 45774
.. date: 2022-03-04-21-24-02
.. nonce: 9AhC0r
.. section: Build

``configure`` now verifies that all SQLite C APIs needed for the
:mod:`sqlite3` extension module are found.

..

.. bpo: 47194
.. date: 2022-04-01-14-57-40
.. nonce: IB0XL4
.. section: Windows

Update ``zlib`` to v1.2.12 to resolve :cve:`2018-25032`.

..

.. bpo: 47171
.. date: 2022-03-30-19-55-00
.. nonce: MbqCWn
.. section: Windows

Enables installing the :file:`py.exe` launcher on Windows ARM64.

..

.. bpo: 46566
.. date: 2022-03-23-12-51-46
.. nonce: 4x4a7e
.. section: Windows

Upgraded :ref:`launcher` to support a new ``-V:company/tag`` argument for
full :pep:`514` support and to detect ARM64 installs. The ``-64`` suffix on
arguments is deprecated, but still selects any non-32-bit install. Setting
:envvar:`PYLAUNCHER_ALLOW_INSTALL` and specifying a version that is not
installed will attempt to install the requested version from the Microsoft
Store.

..

.. bpo: 47086
.. date: 2022-03-21-20-45-01
.. nonce: bIuKlF
.. section: Windows

The installer for Windows now includes documentation as loose HTML files
rather than a single compiled :file:`.chm` file.

..

.. bpo: 46907
.. date: 2022-03-13-11-18-41
.. nonce: YLzxBM
.. section: Windows

Update Windows installer to use SQLite 3.38.1.

..

.. bpo: 44549
.. date: 2022-03-07-17-46-40
.. nonce: SPrGS9
.. section: Windows

Update bzip2 to 1.0.8 in Windows builds to mitigate :cve:`2016-3189` and
:cve:`2019-12900`.

..

.. bpo: 46948
.. date: 2022-03-07-16-34-11
.. nonce: Ufd4tG
.. section: Windows

Prevent :cve:`2022-26488` by ensuring the Add to PATH option in the Windows
installer uses the correct path when being repaired.

..

.. bpo: 46890
.. date: 2022-03-17-09-55-02
.. nonce: GX-3OO
.. section: macOS

Fix a regression in the setting of ``sys._base_executable`` in framework
builds, and thereby fix a regression in :mod:`venv` virtual environments
with such builds.

..

.. bpo: 46907
.. date: 2022-03-13-11-11-31
.. nonce: Ql0z1E
.. section: macOS

Update macOS installer to SQLite 3.38.1.

..

.. bpo: 40280
.. date: 2022-04-03-11-47-45
.. nonce: Q_IJik
.. section: Tools/Demos

Replace Emscripten's limited shell with Katie Bell's browser-ui REPL from
python-wasm project.

..

.. bpo: 40421
.. date: 2022-03-25-13-40-46
.. nonce: wJREl2
.. section: C API

Add ``PyFrame_GetBuiltins``, ``PyFrame_GetGenerator`` and
``PyFrame_GetGlobals`` C-API functions to access frame object attributes
safely from C code.

..

.. bpo: 46850
.. date: 2022-03-22-16-59-34
.. nonce: lmEKLy
.. section: C API

Move the private ``_PyFrameEvalFunction`` type, and private
``_PyInterpreterState_GetEvalFrameFunc()`` and
``_PyInterpreterState_SetEvalFrameFunc()`` functions to the internal C API.
The ``_PyFrameEvalFunction`` callback function type now uses the
``_PyInterpreterFrame`` type which is part of the internal C API. Patch by
Victor Stinner.

..

.. bpo: 46850
.. date: 2022-03-22-16-48-02
.. nonce: 7M5dO7
.. section: C API

Move the private undocumented ``_PyEval_EvalFrameDefault()`` function to the
internal C API. The function now uses the ``_PyInterpreterFrame`` type which
is part of the internal C API. Patch by Victor Stinner.

..

.. bpo: 46850
.. date: 2022-03-21-02-26-27
.. nonce: hU3c-O
.. section: C API

Remove the private undocumented function ``_PyEval_CallTracing()`` from the
C API. Call the public :func:`sys.call_tracing` function instead. Patch by
Victor Stinner.

..

.. bpo: 46850
.. date: 2022-03-21-01-30-14
.. nonce: Tfxde5
.. section: C API

Remove the private undocumented function
``_PyEval_GetCoroutineOriginTrackingDepth()`` from the C API. Call the
public :func:`sys.get_coroutine_origin_tracking_depth` function instead.
Patch by Victor Stinner.

..

.. bpo: 46850
.. date: 2022-03-21-00-41-29
.. nonce: rOt771
.. section: C API

Remove the following private undocumented functions from the C API:

* ``_PyEval_GetAsyncGenFirstiter()``
* ``_PyEval_GetAsyncGenFinalizer()``
* ``_PyEval_SetAsyncGenFirstiter()``
* ``_PyEval_SetAsyncGenFinalizer()``

Call the public :func:`sys.get_asyncgen_hooks` and
:func:`sys.set_asyncgen_hooks` functions instead. Patch by Victor Stinner.

..

.. bpo: 46987
.. date: 2022-03-12-18-37-06
.. nonce: LWcwyN
.. section: C API

Remove private functions ``_PySys_GetObjectId()`` and
``_PySys_SetObjectId()``. Patch by Donghee Na.

..

.. bpo: 46906
.. date: 2022-03-03-11-12-33
.. nonce: -olyBI
.. section: C API

Add new functions to pack and unpack C double (serialize and deserialize):
:c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`,
:c:func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and
:c:func:`PyFloat_Unpack8`. Patch by Victor Stinner.
