Merge branch 'main' into complex_formats

This commit is contained in:
Victor Stinner 2026-05-02 16:03:08 +02:00
commit 6753bae91c
421 changed files with 12784 additions and 5518 deletions

3
.gitattributes vendored
View file

@ -34,6 +34,9 @@ Lib/test/xmltestdata/* noeol
Lib/venv/scripts/common/activate text eol=lf
Lib/venv/scripts/posix/* text eol=lf
# Prevent GitHub's web conflict editor from converting LF to CRLF
*.rst text eol=lf
# CRLF files
[attr]dos text eol=crlf

View file

@ -1,28 +0,0 @@
name: Read the Docs PR preview
# Automatically edits a pull request's descriptions with a link
# to the documentation's preview on Read the Docs.
on:
pull_request_target:
types:
- opened
paths:
- 'Doc/**'
- '.github/workflows/doc.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
documentation-links:
runs-on: ubuntu-latest
permissions:
pull-requests: write
timeout-minutes: 5
steps:
- uses: readthedocs/actions/preview@b8bba1484329bda1a3abe986df7ebc80a8950333 # v1.5
with:
project-slug: "cpython-previews"
single-version: "true"

View file

@ -19,6 +19,7 @@ on:
- "Tools/build/consts_getter.py"
- "Tools/build/deepfreeze.py"
- "Tools/build/generate-build-details.py"
- "Tools/build/generate_levenshtein_examples.py"
- "Tools/build/generate_sbom.py"
- "Tools/build/generate_stdlib_module_names.py"
- "Tools/build/mypy.ini"

View file

@ -26,9 +26,16 @@ apt-get -yq --no-install-recommends install \
xvfb \
zlib1g-dev
# Workaround missing libmpdec-dev on ubuntu 24.04:
# https://launchpad.net/~ondrej/+archive/ubuntu/php
# https://deb.sury.org/
sudo add-apt-repository ppa:ondrej/php
apt-get update
apt-get -yq --no-install-recommends install libmpdec-dev
# Workaround missing libmpdec-dev on ubuntu 24.04 by building mpdecimal
# from source. ppa:ondrej/php (launchpad.net) are unreliable
# (https://status.canonical.com) so fetch the tarball directly
# from the upstream host.
# https://www.bytereef.org/mpdecimal/
MPDECIMAL_VERSION=4.0.1
curl -fsSL "https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-${MPDECIMAL_VERSION}.tar.gz" \
| tar -xz -C /tmp
(cd "/tmp/mpdecimal-${MPDECIMAL_VERSION}" \
&& ./configure --prefix=/usr/local \
&& make -j"$(nproc)" \
&& make install)
ldconfig

View file

@ -56,7 +56,7 @@ jobs:
with:
python-version: '3'
cache: 'pip'
cache-dependency-path: 'Doc/requirements.txt'
cache-dependency-path: 'Doc/pylock.toml'
- name: 'Install build dependencies'
run: make -C Doc/ venv

View file

@ -40,17 +40,15 @@ jobs:
# Install clang
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100
sudo update-alternatives --set clang /usr/bin/clang-20
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 100
sudo update-alternatives --set clang++ /usr/bin/clang++-20
if [ "${SANITIZER}" = "TSan" ]; then
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
sudo update-alternatives --set clang /usr/bin/clang-17
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
sudo update-alternatives --set clang++ /usr/bin/clang++-17
# Reduce ASLR to avoid TSan crashing
sudo sysctl -w vm.mmap_rnd_bits=28
else
sudo ./llvm.sh 20
fi
- name: Sanitizer option setup

View file

@ -13,7 +13,7 @@ JOBS = auto
PAPER =
SOURCES =
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
REQUIREMENTS = requirements.txt
REQUIREMENTS = pylock.toml
SPHINXERRORHANDLING = --fail-on-warning
# Internal variables.

View file

@ -2,7 +2,7 @@
.. _allocating-objects:
Allocating Objects on the Heap
Allocating objects on the heap
==============================
@ -153,10 +153,12 @@ Allocating Objects on the Heap
To allocate and create extension modules.
Deprecated aliases
^^^^^^^^^^^^^^^^^^
Soft-deprecated aliases
^^^^^^^^^^^^^^^^^^^^^^^
These are :term:`soft deprecated` aliases to existing functions and macros.
.. soft-deprecated:: 3.15
These are aliases to existing functions and macros.
They exist solely for backwards compatibility.
@ -164,7 +166,7 @@ They exist solely for backwards compatibility.
:widths: auto
:header-rows: 1
* * Deprecated alias
* * Soft-deprecated alias
* Function
* * .. c:macro:: PyObject_NEW(type, typeobj)
* :c:macro:`PyObject_New`

View file

@ -258,7 +258,9 @@ readonly, format
.. c:macro:: PyBUF_WRITEABLE
This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`.
This is an alias to :c:macro:`PyBUF_WRITABLE`.
.. soft-deprecated:: 3.13
.. c:macro:: PyBUF_FORMAT

View file

@ -47,9 +47,9 @@ called with a non-bytes parameter.
*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents of
the bytes object are uninitialized.
.. deprecated:: 3.15
``PyBytes_FromStringAndSize(NULL, len)`` is :term:`soft deprecated`,
use the :c:type:`PyBytesWriter` API instead.
.. soft-deprecated:: 3.15
Use the :c:type:`PyBytesWriter` API instead of
``PyBytes_FromStringAndSize(NULL, len)``.
.. c:function:: PyObject* PyBytes_FromFormat(const char *format, ...)
@ -238,9 +238,8 @@ called with a non-bytes parameter.
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
returned.
.. deprecated:: 3.15
The function is :term:`soft deprecated`,
use the :c:type:`PyBytesWriter` API instead.
.. soft-deprecated:: 3.15
Use the :c:type:`PyBytesWriter` API instead.
.. c:function:: PyObject *PyBytes_Repr(PyObject *bytes, int smartquotes)

View file

@ -212,7 +212,7 @@ bound into a function.
.. c:function:: PyObject *PyCode_Optimize(PyObject *code, PyObject *consts, PyObject *names, PyObject *lnotab_obj)
This is a :term:`soft deprecated` function that does nothing.
This is a function that does nothing.
Prior to Python 3.10, this function would perform basic optimizations to a
code object.
@ -220,6 +220,8 @@ bound into a function.
.. versionchanged:: 3.10
This function now does nothing.
.. soft-deprecated:: 3.13
.. _c_codeobject_flags:

View file

@ -112,6 +112,7 @@ Other Objects
picklebuffer.rst
weakref.rst
capsule.rst
sentinel.rst
frame.rst
gen.rst
coro.rst

View file

@ -140,7 +140,7 @@ found in the dictionary of type objects.
.. c:macro:: PyDescr_COMMON
This is a :term:`soft deprecated` macro including the common fields for a
This is a macro including the common fields for a
descriptor object.
This was included in Python's C API by mistake; do not use it in extensions.
@ -148,6 +148,8 @@ found in the dictionary of type objects.
descriptor protocol (:c:member:`~PyTypeObject.tp_descr_get` and
:c:member:`~PyTypeObject.tp_descr_set`).
.. soft-deprecated:: 3.15
Built-in descriptors
^^^^^^^^^^^^^^^^^^^^

View file

@ -818,7 +818,7 @@ Exception Classes
.. c:macro:: PyException_HEAD
This is a :term:`soft deprecated` macro including the base fields for an
This is a macro including the base fields for an
exception object.
This was included in Python's C API by mistake and is not designed for use
@ -826,6 +826,8 @@ Exception Classes
:c:func:`PyErr_NewException` or otherwise create a class inheriting from
:c:data:`PyExc_BaseException`.
.. soft-deprecated:: 3.15
Exception Objects
=================

View file

@ -191,10 +191,10 @@ the :c:data:`Py_mod_multiple_interpreters` slot.
``PyInit`` function
...................
.. deprecated:: 3.15
.. soft-deprecated:: 3.15
This functionality is :term:`soft deprecated`.
It will not get new features, but there are no plans to remove it.
This functionality will not get new features,
but there are no plans to remove it.
Instead of :c:func:`PyModExport_modulename`, an extension module can define
an older-style :dfn:`initialization function` with the signature:
@ -272,10 +272,9 @@ For example, a module called ``spam`` would be defined like this::
Legacy single-phase initialization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. deprecated:: 3.15
.. soft-deprecated:: 3.15
Single-phase initialization is :term:`soft deprecated`.
It is a legacy mechanism to initialize extension
Single-phase initialization is a legacy mechanism to initialize extension
modules, with known drawbacks and design flaws. Extension module authors
are encouraged to use multi-phase initialization instead.

View file

@ -2,7 +2,7 @@
.. _fileobjects:
File Objects
File objects
------------
.. index:: pair: object; file
@ -136,11 +136,12 @@ the :mod:`io` APIs instead.
failure; the appropriate exception will be set.
Deprecated API
^^^^^^^^^^^^^^
Soft-deprecated API
^^^^^^^^^^^^^^^^^^^
.. soft-deprecated:: 3.15
These are :term:`soft deprecated` APIs that were included in Python's C API
These are APIs that were included in Python's C API
by mistake. They are documented solely for completeness; use other
``PyFile*`` APIs instead.

View file

@ -86,8 +86,7 @@ Floating-Point Objects
It is equivalent to the :c:macro:`!INFINITY` macro from the C11 standard
``<math.h>`` header.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: Py_NAN
@ -103,8 +102,7 @@ Floating-Point Objects
Equivalent to :c:macro:`!INFINITY`.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.14
.. c:macro:: Py_MATH_E
@ -161,8 +159,8 @@ Floating-Point Objects
that is, it is normal, subnormal or zero, but not infinite or NaN.
Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead.
.. soft-deprecated:: 3.14
Use :c:macro:`!isfinite` instead.
.. c:macro:: Py_IS_INFINITY(X)
@ -170,8 +168,8 @@ Floating-Point Objects
Return ``1`` if the given floating-point number *X* is positive or negative
infinity. Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead.
.. soft-deprecated:: 3.14
Use :c:macro:`!isinf` instead.
.. c:macro:: Py_IS_NAN(X)
@ -179,8 +177,8 @@ Floating-Point Objects
Return ``1`` if the given floating-point number *X* is a not-a-number (NaN)
value. Return ``0`` otherwise.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead.
.. soft-deprecated:: 3.14
Use :c:macro:`!isnan` instead.
Pack and Unpack functions

View file

@ -1,6 +1,6 @@
.. highlight:: c
Frame Objects
Frame objects
-------------
.. c:type:: PyFrameObject
@ -147,7 +147,7 @@ See also :ref:`Reflection <reflection>`.
Return the line number that *frame* is currently executing.
Frame Locals Proxies
Frame locals proxies
^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.13
@ -169,7 +169,7 @@ See :pep:`667` for more information.
Return non-zero if *obj* is a frame :func:`locals` proxy.
Legacy Local Variable APIs
Legacy local variable APIs
^^^^^^^^^^^^^^^^^^^^^^^^^^
These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing.
@ -178,40 +178,34 @@ They exist solely for backwards compatibility.
.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals`
attribute of *f* to the internal "fast" array of local variables, allowing
changes in frame objects to be visible to the interpreter. If *clear* was
true, this function would process variables that were unset in the locals
dictionary.
.. versionchanged:: 3.13
.. soft-deprecated:: 3.13
This function now does nothing.
.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function would copy the internal "fast" array
of local variables (which is used by the interpreter) to the
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
variables to be visible to frame objects.
.. versionchanged:: 3.13
.. soft-deprecated:: 3.13
This function now does nothing.
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
This function is :term:`soft deprecated` and does nothing.
Prior to Python 3.13, this function was similar to
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
``-1`` with an exception set on failure.
.. versionchanged:: 3.13
.. soft-deprecated:: 3.13
This function now does nothing.
@ -219,7 +213,7 @@ They exist solely for backwards compatibility.
:pep:`667`
Internal Frames
Internal frames
^^^^^^^^^^^^^^^
Unless using :pep:`523`, you will not need this.
@ -249,5 +243,3 @@ Unless using :pep:`523`, you will not need this.
Return the currently executing line number, or -1 if there is no line number.
.. versionadded:: 3.12

View file

@ -90,7 +90,9 @@ Deprecated API
.. c:macro:: PyAsyncGenASend_CheckExact(op)
This is a :term:`soft deprecated` API that was included in Python's C API
This is an API that was included in Python's C API
by mistake.
It is solely here for completeness; do not use this API.
.. soft-deprecated:: 3.14

View file

@ -536,16 +536,14 @@ have been standardized in C11 (or previous standards).
Use the standard ``alignas`` specifier rather than this macro.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: PY_FORMAT_SIZE_T
The :c:func:`printf` formatting modifier for :c:type:`size_t`.
Use ``"z"`` directly instead.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: Py_LL(number)
Py_ULL(number)
@ -558,8 +556,7 @@ have been standardized in C11 (or previous standards).
Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: PY_LONG_LONG
PY_INT32_T
@ -572,8 +569,7 @@ have been standardized in C11 (or previous standards).
respectively.
Historically, these types needed compiler-specific extensions.
.. deprecated:: 3.15
These macros are :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: PY_LLONG_MIN
PY_LLONG_MAX
@ -587,16 +583,14 @@ have been standardized in C11 (or previous standards).
The required header, ``<limits.h>``,
:ref:`is included <capi-system-includes>` in ``Python.h``.
.. deprecated:: 3.15
These macros are :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: Py_MEMCPY(dest, src, n)
This is a :term:`soft deprecated` alias to :c:func:`!memcpy`.
Use :c:func:`!memcpy` directly instead.
This is an alias to :c:func:`!memcpy`.
.. deprecated:: 3.14
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.14
Use :c:func:`!memcpy` directly instead.
.. c:macro:: Py_UNICODE_SIZE
@ -606,29 +600,25 @@ have been standardized in C11 (or previous standards).
The required header for the latter, ``<limits.h>``,
:ref:`is included <capi-system-includes>` in ``Python.h``.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: Py_UNICODE_WIDE
Defined if ``wchar_t`` can hold a Unicode character (UCS-4).
Use ``sizeof(wchar_t) >= 4`` instead
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. c:macro:: Py_VA_COPY
This is a :term:`soft deprecated` alias to the C99-standard ``va_copy``
function.
This is an alias to the C99-standard ``va_copy`` function.
Historically, this would use a compiler-specific method to copy a ``va_list``.
.. versionchanged:: 3.6
This is now an alias to ``va_copy``.
.. deprecated:: 3.15
The macro is :term:`soft deprecated`.
.. soft-deprecated:: 3.15
.. _api-objects:

View file

@ -197,12 +197,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
.. c:function:: long PyLong_AS_LONG(PyObject *obj)
A :term:`soft deprecated` alias.
Exactly equivalent to the preferred ``PyLong_AsLong``. In particular,
it can fail with :exc:`OverflowError` or another exception.
.. deprecated:: 3.14
The function is soft deprecated.
.. soft-deprecated:: 3.14
.. c:function:: int PyLong_AsInt(PyObject *obj)

View file

@ -965,9 +965,7 @@ or code that creates modules dynamically.
// PyModule_AddObject() stole a reference to obj:
// Py_XDECREF(obj) is not needed here.
.. deprecated:: 3.13
:c:func:`PyModule_AddObject` is :term:`soft deprecated`.
.. soft-deprecated:: 3.13
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)

View file

@ -205,6 +205,4 @@ would typically correspond to a Python function.
.. versionadded:: 3.13
.. deprecated:: 3.14
This function is :term:`soft deprecated`.
.. soft-deprecated:: 3.14

View file

@ -31,7 +31,7 @@ Note that holding an :term:`attached thread state` is not required for these API
or ``-2`` on failure to create a lock. Check ``errno`` for more information
about the cause of a failure.
.. c:function:: int PyUnstable_WritePerfMapEntry(const void *code_addr, unsigned int code_size, const char *entry_name)
.. c:function:: int PyUnstable_WritePerfMapEntry(const void *code_addr, size_t code_size, const char *entry_name)
Write one single entry to the ``/tmp/perf-$pid.map`` file. This function is
thread safe. Here is what an example entry looks like::

35
Doc/c-api/sentinel.rst Normal file
View file

@ -0,0 +1,35 @@
.. highlight:: c
.. _sentinelobjects:
Sentinel objects
----------------
.. c:var:: PyTypeObject PySentinel_Type
This instance of :c:type:`PyTypeObject` represents the Python
:class:`sentinel` type. This is the same object as :class:`sentinel`.
.. versionadded:: next
.. c:function:: int PySentinel_Check(PyObject *o)
Return true if *o* is a :class:`sentinel` object. The :class:`sentinel` type
does not allow subclasses, so this check is exact.
.. versionadded:: next
.. c:function:: PyObject* PySentinel_New(const char *name, const char *module_name)
Return a new :class:`sentinel` object with :attr:`~sentinel.__name__` set to
*name* and :attr:`~sentinel.__module__` set to *module_name*.
*name* must not be ``NULL``. If *module_name* is ``NULL``, :attr:`~sentinel.__module__`
is set to ``None``.
Return ``NULL`` with an exception set on failure.
For pickling to work, *module_name* must be the name of an importable
module, and the sentinel must be accessible from that module under a
path matching *name*. Pickle treats *name* as a global variable name
in *module_name* (see :meth:`object.__reduce__`).
.. versionadded:: next

View file

@ -109,9 +109,8 @@ Sequence Protocol
Alias for :c:func:`PySequence_Contains`.
.. deprecated:: 3.14
The function is :term:`soft deprecated` and should no longer be used to
write new code.
.. soft-deprecated:: 3.14
The function should no longer be used to write new code.
.. c:function:: Py_ssize_t PySequence_Index(PyObject *o, PyObject *value)

View file

@ -201,7 +201,7 @@ Deprecated API
.. c:macro:: PySet_MINSIZE
A :term:`soft deprecated` constant representing the size of an internal
A constant representing the size of an internal
preallocated table inside :c:type:`PySetObject` instances.
This is documented solely for completeness, as there are no guarantees
@ -211,3 +211,5 @@ Deprecated API
:c:macro:`!PySet_MINSIZE` can be replaced with a small constant like ``8``.
If looking for the size of a set, use :c:func:`PySet_Size` instead.
.. soft-deprecated:: 3.14

View file

@ -1391,8 +1391,8 @@ and :c:data:`PyType_Type` effectively act as defaults.)
.. versionchanged:: 3.9
Renamed to the current name, without the leading underscore.
The old provisional name is :term:`soft deprecated`.
Renamed to the current name, without the leading underscore.
The old provisional name is :term:`soft deprecated`.
.. versionchanged:: 3.12
@ -1501,11 +1501,13 @@ and :c:data:`PyType_Type` effectively act as defaults.)
.. c:macro:: Py_TPFLAGS_HAVE_VERSION_TAG
This is a :term:`soft deprecated` macro that does nothing.
This macro does nothing.
Historically, this would indicate that the
:c:member:`~PyTypeObject.tp_version_tag` field was available and
initialized.
.. soft-deprecated:: 3.13
.. c:macro:: Py_TPFLAGS_INLINE_VALUES

View file

@ -2037,6 +2037,10 @@ PySeqIter_Check:PyObject *:op:0:
PySeqIter_New:PyObject*::+1:
PySeqIter_New:PyObject*:seq:0:
PySentinel_New:PyObject*::+1:
PySentinel_New:const char*:name::
PySentinel_New:const char*:module_name::
PySequence_Check:int:::
PySequence_Check:PyObject*:o:0:

View file

@ -60,7 +60,7 @@ Pending removal in Python 3.15
* :mod:`types`:
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
* :class:`types.CodeType`: Accessing :attr:`!codeobject.co_lnotab` was
deprecated in :pep:`626`
since 3.10 and was planned to be removed in 3.12,
but it only got a proper :exc:`DeprecationWarning` in 3.12.

View file

@ -35,7 +35,7 @@ Pending removal in Python 3.17
- Passing non-ascii *encoding* names to :func:`encodings.normalize_encoding`
is deprecated and scheduled for removal in Python 3.17.
(Contributed by Stan Ulbrych in :gh:`136702`)
(Contributed by Stan Ulbrych in :gh:`136702`.)
* :mod:`typing`:

View file

@ -47,7 +47,7 @@ although there is currently no date scheduled for their removal.
* :mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:`133038`)
* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
* :attr:`!codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method
instead.
* :mod:`datetime`:

View file

@ -1924,7 +1924,7 @@ correctly using identity tests:
.. code-block:: python
_sentinel = object()
_sentinel = sentinel('_sentinel')
def pop(self, key, default=_sentinel):
if key in self:

View file

@ -594,7 +594,7 @@ a pure Python equivalent:
def object_getattribute(obj, name):
"Emulate PyObject_GenericGetAttr() in Objects/object.c"
null = object()
null = sentinel('null')
objtype = type(obj)
cls_var = find_name_in_mro(objtype, name, null)
descr_get = getattr(type(cls_var), '__get__', null)
@ -1635,12 +1635,12 @@ by member descriptors:
.. testcode::
null = object()
null = sentinel('null')
class Member:
def __init__(self, name, clsname, offset):
'Emulate PyMemberDef in Include/structmember.h'
'Emulate PyMemberDef in Include/descrobject.h'
# Also see descr_new() in Objects/descrobject.c
self.name = name
self.clsname = clsname

View file

@ -371,7 +371,7 @@ Equality comparisons are defined though::
>>> Color.BLUE == Color.BLUE
True
Comparisons against non-enumeration values will always compare not equal
Equality comparisons against non-enumeration values will always return ``False``
(again, :class:`IntEnum` was explicitly designed to behave differently, see
below)::

View file

@ -416,11 +416,9 @@ C API extensions need to be built specifically for the free-threaded build.
The wheels, shared libraries, and binaries are indicated by a ``t`` suffix.
* `pypa/manylinux <https://github.com/pypa/manylinux>`_ supports the
free-threaded build, with the ``t`` suffix, such as ``python3.13t``.
* `pypa/cibuildwheel <https://github.com/pypa/cibuildwheel>`_ supports the
free-threaded build on Python 3.13 and 3.14. On Python 3.14, free-threaded
wheels will be built by default. On Python 3.13, you will need to set
`CIBW_ENABLE to cpython-freethreading <https://cibuildwheel.pypa.io/en/stable/options/#enable>`_.
free-threaded build, with the ``t`` suffix, such as ``python3.14t``.
* `pypa/cibuildwheel <https://github.com/pypa/cibuildwheel>`_ supports
building wheels for the free-threaded build of Python 3.14 and newer.
Limited C API and Stable ABI
............................

View file

@ -217,8 +217,9 @@ Example, using the :mod:`sys` APIs in file :file:`example.py`:
How to obtain the best results
------------------------------
For best results, Python should be compiled with
``CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"`` as this allows
For best results, keep frame pointers enabled. On supported GCC-compatible
toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and, when
available, ``-mno-omit-leaf-frame-pointer`` by default. These flags allow
profilers to unwind using only the frame pointer and not on DWARF debug
information. This is because as the code that is interposed to allow ``perf``
support is dynamically generated it doesn't have any DWARF debugging information

View file

@ -35,6 +35,8 @@ The abstract grammar is currently defined as follows:
:language: asdl
.. _ast_nodes:
Node classes
------------
@ -164,8 +166,7 @@ Node classes
Previous versions of Python allowed the creation of AST nodes that were missing
required fields. Similarly, AST node constructors allowed arbitrary keyword
arguments that were set as attributes of the AST node, even if they did not
match any of the fields of the AST node. This behavior is deprecated and will
be removed in Python 3.15.
match any of the fields of the AST node. These cases now raise a :exc:`TypeError`.
.. note::
The descriptions of the specific node classes displayed here
@ -2480,7 +2481,7 @@ and classes for traversing abstract syntax trees:
node = YourTransformer().visit(node)
.. function:: dump(node, annotate_fields=True, include_attributes=False, *, indent=None, show_empty=False)
.. function:: dump(node, annotate_fields=True, include_attributes=False, *, color=False, indent=None, show_empty=False)
Return a formatted dump of the tree in *node*. This is mainly useful for
debugging purposes. If *annotate_fields* is true (by default),
@ -2490,6 +2491,10 @@ and classes for traversing abstract syntax trees:
numbers and column offsets are not dumped by default. If this is wanted,
*include_attributes* can be set to true.
If *color* is ``True``, the returned string is syntax highlighted using
ANSI escape sequences.
If ``False`` (the default), colored output is always disabled.
If *indent* is a non-negative integer or string, then the tree will be
pretty-printed with that indent level. An indent level
of 0, negative, or ``""`` will only insert newlines. ``None`` (the default)
@ -2527,6 +2532,9 @@ and classes for traversing abstract syntax trees:
.. versionchanged:: 3.15
Omit optional ``Load()`` values by default.
.. versionchanged:: next
Added the *color* parameter.
.. _ast-compiler-flags:
@ -2584,6 +2592,10 @@ Command-line usage
.. versionadded:: 3.9
.. versionchanged:: next
The output is now syntax highlighted by default. This can be
:ref:`controlled using environment variables <using-on-controlling-color>`.
The :mod:`!ast` module can be executed as a script from the command line.
It is as simple as:

View file

@ -304,7 +304,7 @@ generator can occur in an unexpected order::
try:
yield 2
finally:
await asyncio.sleep(0.1) # immitate some async work
await asyncio.sleep(0.1) # imitate some async work
work_done = True

View file

@ -355,6 +355,34 @@ and reliable way to wait for all tasks in the group to finish.
Passes on all *kwargs* to :meth:`loop.create_task`
.. method:: cancel()
Cancel the task group. This is a non-exceptional, early exit of the
task group's lifetime -- useful once the group's goal has been met or
its services no longer needed.
:meth:`~asyncio.Task.cancel` will be called on any tasks in the group that
aren't yet done, as well as the parent (body) of the group. The task group
context manager will exit *without* :exc:`asyncio.CancelledError` being raised.
If :meth:`cancel` is called before entering the task group, the group will be
cancelled upon entry. This is useful for patterns where one piece of
code passes an unused :class:`asyncio.TaskGroup` instance to another in order to have
the ability to cancel anything run within the group.
:meth:`cancel` is idempotent and may be called after the task group has
already exited.
Some ways to use :meth:`cancel`:
* call it from the task group body based on some condition or event
* pass the task group instance to child tasks via :meth:`create_task`, allowing a child
task to conditionally cancel the entire entire group
* pass the task group instance or bound :meth:`cancel` method to some other task *before*
opening the task group, allowing remote cancellation
.. versionadded:: next
Example::
async def main():
@ -366,7 +394,8 @@ Example::
The ``async with`` statement will wait for all tasks in the group to finish.
While waiting, new tasks may still be added to the group
(for example, by passing ``tg`` into one of the coroutines
and calling ``tg.create_task()`` in that coroutine).
and calling ``tg.create_task()`` in that coroutine). There is also opportunity to
request termination of the entire task group with ``tg.cancel()``, based on some condition.
Once the last task has finished and the ``async with`` block is exited,
no new tasks may be added to the group.
@ -427,53 +456,6 @@ reported by :meth:`asyncio.Task.cancelling`.
Improved handling of simultaneous internal and external cancellations
and correct preservation of cancellation counts.
Terminating a task group
------------------------
While terminating a task group is not natively supported by the standard
library, termination can be achieved by adding an exception-raising task
to the task group and ignoring the raised exception:
.. code-block:: python
import asyncio
from asyncio import TaskGroup
class TerminateTaskGroup(Exception):
"""Exception raised to terminate a task group."""
async def force_terminate_task_group():
"""Used to force termination of a task group."""
raise TerminateTaskGroup()
async def job(task_id, sleep_time):
print(f'Task {task_id}: start')
await asyncio.sleep(sleep_time)
print(f'Task {task_id}: done')
async def main():
try:
async with TaskGroup() as group:
# spawn some tasks
group.create_task(job(1, 0.5))
group.create_task(job(2, 1.5))
# sleep for 1 second
await asyncio.sleep(1)
# add an exception-raising task to force the group to terminate
group.create_task(force_terminate_task_group())
except* TerminateTaskGroup:
pass
asyncio.run(main())
Expected output:
.. code-block:: text
Task 1: start
Task 2: start
Task 1: done
Sleeping
========

View file

@ -73,8 +73,8 @@ POST request.
Added the *padded* and *wrapcol* parameters.
.. function:: b64decode(s, altchars=None, validate=False, *, padded=True)
b64decode(s, altchars=None, validate=True, *, ignorechars, padded=True)
.. function:: b64decode(s, altchars=None, validate=False, *, padded=True, canonical=False)
b64decode(s, altchars=None, validate=True, *, ignorechars, padded=True, canonical=False)
Decode the Base64 encoded :term:`bytes-like object` or ASCII string
*s* and return the decoded :class:`bytes`.
@ -112,10 +112,13 @@ POST request.
If *validate* is true, these non-alphabet characters in the input
result in a :exc:`binascii.Error`.
If *canonical* is true, non-zero padding bits are rejected.
See :func:`binascii.a2b_base64` for details.
For more information about the strict base64 check, see :func:`binascii.a2b_base64`
.. versionchanged:: 3.15
Added the *ignorechars* and *padded* parameters.
Added the *canonical*, *ignorechars*, and *padded* parameters.
.. deprecated:: 3.15
Accepting the ``+`` and ``/`` characters with an alternative alphabet
@ -179,7 +182,7 @@ POST request.
Added the *padded* and *wrapcol* parameters.
.. function:: b32decode(s, casefold=False, map01=None, *, padded=True, ignorechars=b'')
.. function:: b32decode(s, casefold=False, map01=None, *, padded=True, ignorechars=b'', canonical=False)
Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and
return the decoded :class:`bytes`.
@ -205,12 +208,15 @@ POST request.
*ignorechars* should be a :term:`bytes-like object` containing characters
to ignore from the input.
If *canonical* is true, non-zero padding bits are rejected.
See :func:`binascii.a2b_base32` for details.
A :exc:`binascii.Error` is raised if *s* is
incorrectly padded or if there are non-alphabet characters present in the
input.
.. versionchanged:: 3.15
Added the *ignorechars* and *padded* parameters.
Added the *canonical*, *ignorechars*, and *padded* parameters.
.. function:: b32hexencode(s, *, padded=True, wrapcol=0)
@ -224,7 +230,7 @@ POST request.
Added the *padded* and *wrapcol* parameters.
.. function:: b32hexdecode(s, casefold=False, *, padded=True, ignorechars=b'')
.. function:: b32hexdecode(s, casefold=False, *, padded=True, ignorechars=b'', canonical=False)
Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined in
:rfc:`4648`.
@ -237,7 +243,7 @@ POST request.
.. versionadded:: 3.10
.. versionchanged:: 3.15
Added the *ignorechars* and *padded* parameters.
Added the *canonical*, *ignorechars*, and *padded* parameters.
.. function:: b16encode(s, *, wrapcol=0)
@ -317,7 +323,7 @@ Refer to the documentation of the individual functions for more information.
.. versionadded:: 3.4
.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v')
.. function:: a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v', canonical=False)
Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and
return the decoded :class:`bytes`.
@ -334,8 +340,16 @@ Refer to the documentation of the individual functions for more information.
This should only contain whitespace characters, and by
default contains all whitespace characters in ASCII.
If *canonical* is true, non-canonical encodings are rejected.
See :func:`binascii.a2b_ascii85` for details.
.. versionadded:: 3.4
.. versionchanged:: next
Added the *canonical* parameter.
Single-character final groups are now always rejected as encoding
violations.
.. function:: b85encode(b, pad=False, *, wrapcol=0)
@ -355,7 +369,7 @@ Refer to the documentation of the individual functions for more information.
Added the *wrapcol* parameter.
.. function:: b85decode(b, *, ignorechars=b'')
.. function:: b85decode(b, *, ignorechars=b'', canonical=False)
Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and
return the decoded :class:`bytes`. Padding is implicitly removed, if
@ -364,10 +378,15 @@ Refer to the documentation of the individual functions for more information.
*ignorechars* should be a :term:`bytes-like object` containing characters
to ignore from the input.
If *canonical* is true, non-canonical encodings are rejected.
See :func:`binascii.a2b_base85` for details.
.. versionadded:: 3.4
.. versionchanged:: 3.15
Added the *ignorechars* parameter.
Added the *canonical* and *ignorechars* parameters.
Single-character final groups are now always rejected as encoding
violations.
.. function:: z85encode(s, pad=False, *, wrapcol=0)
@ -392,7 +411,7 @@ Refer to the documentation of the individual functions for more information.
Added the *wrapcol* parameter.
.. function:: z85decode(s, *, ignorechars=b'')
.. function:: z85decode(s, *, ignorechars=b'', canonical=False)
Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and
return the decoded :class:`bytes`. See `Z85 specification
@ -401,10 +420,15 @@ Refer to the documentation of the individual functions for more information.
*ignorechars* should be a :term:`bytes-like object` containing characters
to ignore from the input.
If *canonical* is true, non-canonical encodings are rejected.
See :func:`binascii.a2b_base85` for details.
.. versionadded:: 3.13
.. versionchanged:: 3.15
Added the *ignorechars* parameter.
Added the *canonical* and *ignorechars* parameters.
Single-character final groups are now always rejected as encoding
violations.
.. _base64-legacy:

View file

@ -48,8 +48,8 @@ The :mod:`!binascii` module defines the following functions:
Added the *backtick* parameter.
.. function:: a2b_base64(string, /, *, padded=True, alphabet=BASE64_ALPHABET, strict_mode=False)
a2b_base64(string, /, *, ignorechars, padded=True, alphabet=BASE64_ALPHABET, strict_mode=True)
.. function:: a2b_base64(string, /, *, padded=True, alphabet=BASE64_ALPHABET, strict_mode=False, canonical=False)
a2b_base64(string, /, *, ignorechars, padded=True, alphabet=BASE64_ALPHABET, strict_mode=True, canonical=False)
Convert a block of base64 data back to binary and return the binary data. More
than one line may be passed at a time.
@ -83,11 +83,15 @@ The :mod:`!binascii` module defines the following functions:
* Contains no excess data after padding (including excess padding, newlines, etc.).
* Does not start with a padding.
If *canonical* is true, non-zero padding bits in the last group are rejected
with :exc:`binascii.Error`, enforcing canonical encoding as defined in
:rfc:`4648` section 3.5. This check is independent of *strict_mode*.
.. versionchanged:: 3.11
Added the *strict_mode* parameter.
.. versionchanged:: 3.15
Added the *alphabet*, *ignorechars* and *padded* parameters.
Added the *alphabet*, *canonical*, *ignorechars*, and *padded* parameters.
.. function:: b2a_base64(data, *, padded=True, alphabet=BASE64_ALPHABET, wrapcol=0, newline=True)
@ -113,7 +117,7 @@ The :mod:`!binascii` module defines the following functions:
Added the *alphabet*, *padded* and *wrapcol* parameters.
.. function:: a2b_ascii85(string, /, *, foldspaces=False, adobe=False, ignorechars=b'')
.. function:: a2b_ascii85(string, /, *, foldspaces=False, adobe=False, ignorechars=b'', canonical=False)
Convert Ascii85 data back to binary and return the binary data.
@ -122,7 +126,8 @@ The :mod:`!binascii` module defines the following functions:
characters). Each group encodes 32 bits of binary data in the range from
``0`` to ``2 ** 32 - 1``, inclusive. The special character ``z`` is
accepted as a short form of the group ``!!!!!``, which encodes four
consecutive null bytes.
consecutive null bytes. A single-character final group is always rejected
as an encoding violation.
*foldspaces* is a flag that specifies whether the 'y' short sequence
should be accepted as shorthand for 4 consecutive spaces (ASCII 0x20).
@ -135,6 +140,12 @@ The :mod:`!binascii` module defines the following functions:
to ignore from the input.
This should only contain whitespace characters.
If *canonical* is true, non-canonical encodings are rejected with
:exc:`binascii.Error`. Here "canonical" means the encoding that
:func:`b2a_ascii85` would produce: the ``z`` abbreviation must be used
for all-zero groups (rather than ``!!!!!``), and partial final groups
must use the same padding digits as the encoder.
Invalid Ascii85 data will raise :exc:`binascii.Error`.
.. versionadded:: 3.15
@ -163,7 +174,7 @@ The :mod:`!binascii` module defines the following functions:
.. versionadded:: 3.15
.. function:: a2b_base85(string, /, *, alphabet=BASE85_ALPHABET, ignorechars=b'')
.. function:: a2b_base85(string, /, *, alphabet=BASE85_ALPHABET, ignorechars=b'', canonical=False)
Convert Base85 data back to binary and return the binary data.
More than one line may be passed at a time.
@ -171,7 +182,8 @@ The :mod:`!binascii` module defines the following functions:
Valid Base85 data contains characters from the Base85 alphabet in groups
of five (except for the final group, which may have from two to five
characters). Each group encodes 32 bits of binary data in the range from
``0`` to ``2 ** 32 - 1``, inclusive.
``0`` to ``2 ** 32 - 1``, inclusive. A single-character final group is
always rejected as an encoding violation.
Optional *alphabet* must be a :class:`bytes` object of length 85 which
specifies an alternative alphabet.
@ -179,6 +191,11 @@ The :mod:`!binascii` module defines the following functions:
*ignorechars* should be a :term:`bytes-like object` containing characters
to ignore from the input.
If *canonical* is true, non-canonical encodings are rejected with
:exc:`binascii.Error`. Here "canonical" means the encoding that
:func:`b2a_base85` would produce: partial final groups must use the
same padding digits as the encoder.
Invalid Base85 data will raise :exc:`binascii.Error`.
.. versionadded:: 3.15
@ -202,7 +219,7 @@ The :mod:`!binascii` module defines the following functions:
.. versionadded:: 3.15
.. function:: a2b_base32(string, /, *, padded=True, alphabet=BASE32_ALPHABET, ignorechars=b'')
.. function:: a2b_base32(string, /, *, padded=True, alphabet=BASE32_ALPHABET, ignorechars=b'', canonical=False)
Convert base32 data back to binary and return the binary data.
@ -231,6 +248,10 @@ The :mod:`!binascii` module defines the following functions:
presented before the end of the encoded data and the excess pad characters
will be ignored.
If *canonical* is true, non-zero padding bits in the last group are rejected
with :exc:`binascii.Error`, enforcing canonical encoding as defined in
:rfc:`4648` section 3.5.
Invalid base32 data will raise :exc:`binascii.Error`.
.. versionadded:: 3.15

View file

@ -54,13 +54,13 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
.. method:: setfirstweekday(firstweekday)
Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)
Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6).
Identical to setting the :attr:`~Calendar.firstweekday` property.
.. method:: iterweekdays()
Return an iterator for the week day numbers that will be used for one
Return an iterator for the weekday numbers that will be used for one
week. The first value from the iterator will be the same as the value of
the :attr:`~Calendar.firstweekday` property.
@ -86,7 +86,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
Return an iterator for the month *month* in the year *year* similar to
:meth:`itermonthdates`, but not restricted by the :class:`datetime.date`
range. Days returned will be tuples consisting of a day of the month
number and a week day number.
number and a weekday number.
.. method:: itermonthdays3(year, month)
@ -408,7 +408,7 @@ For simple text calendars this module provides the following functions.
.. function:: monthrange(year, month)
Returns weekday of first day of the month and number of days in month, for the
Returns weekday of first day of the month and number of days in month, for the
specified *year* and *month*.
@ -446,7 +446,7 @@ For simple text calendars this module provides the following functions.
An unrelated but handy function that takes a time tuple such as returned by
the :func:`~time.gmtime` function in the :mod:`time` module, and returns the
corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX
encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each others'
encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's
inverse.
@ -580,9 +580,14 @@ The :mod:`!calendar` module defines the following exceptions:
.. exception:: IllegalMonthError(month)
A subclass of :exc:`ValueError`,
A subclass of :exc:`ValueError` and :exc:`IndexError`,
raised when the given month number is outside of the range 1-12 (inclusive).
.. versionchanged:: 3.12
:exc:`IllegalMonthError` is now also a subclass of
:exc:`ValueError`. New code should avoid catching
:exc:`IndexError`.
.. attribute:: month
The invalid month number.

View file

@ -326,7 +326,7 @@ For example::
.. versionadded:: 3.10
The usual dictionary methods are available for :class:`Counter` objects
except for two which work differently for counters.
except for these two which work differently for counters:
.. method:: fromkeys(iterable)

View file

@ -331,10 +331,14 @@ Compressing and decompressing data in memory
If *max_length* is non-negative, the method returns at most *max_length*
bytes of decompressed data. If this limit is reached and further
output can be produced, the :attr:`~.needs_input` attribute will
be set to ``False``. In this case, the next call to
output can be produced (or EOF is reached), the :attr:`~.needs_input`
attribute will be set to ``False``. In this case, the next call to
:meth:`~.decompress` may provide *data* as ``b''`` to obtain
more of the output.
more of the output. The full content can thus be read like::
process_output(d.decompress(data, max_length))
while not d.eof and not d.needs_input:
process_output(d.decompress(b"", max_length))
If all of the input data was decompressed and returned (either
because this was less than *max_length* bytes, or because

View file

@ -467,12 +467,40 @@ Functions and classes provided:
statements. If this is not the case, then the original construct with the
explicit :keyword:`!with` statement inside the function should be used.
When the decorated callable is a generator function, coroutine function, or
asynchronous generator function, the returned wrapper is of the same kind
and keeps the context manager open for the lifetime of the iteration or
await rather than only for the call that creates the generator or coroutine
object. Wrapped generators and asynchronous generators are explicitly
closed when iteration ends, as if by :func:`closing` or :func:`aclosing`.
.. note::
For asynchronous generators the wrapper re-yields each value with
``async for``; values sent with :meth:`~agen.asend` and exceptions
thrown with :meth:`~agen.athrow` are not forwarded to the wrapped
generator.
.. versionadded:: 3.2
.. versionchanged:: next
Decorating a generator function, coroutine function, or asynchronous
generator function now keeps the context manager open across iteration
or await. Previously the context manager exited as soon as the
generator or coroutine object was created.
.. class:: AsyncContextDecorator
Similar to :class:`ContextDecorator` but only for asynchronous functions.
Similar to :class:`ContextDecorator`, but the context manager is entered
and exited with :keyword:`async with`. Decorate coroutine functions and
asynchronous generator functions with this class; the returned wrapper is
of the same kind.
.. note::
Synchronous functions and generators are accepted, but the wrapper is
always asynchronous, so the decorated callable must then be awaited or
iterated with ``async for``. If that change of calling convention is
not intended, use :class:`ContextDecorator` instead.
Example of ``AsyncContextDecorator``::
@ -510,6 +538,13 @@ Functions and classes provided:
.. versionadded:: 3.10
.. versionchanged:: next
Decorating an asynchronous generator function now keeps the context
manager open across iteration. Previously the context manager exited
as soon as the generator object was created. Synchronous functions
and synchronous generator functions are also now accepted, with an
asynchronous wrapper returned.
.. class:: ExitStack()

View file

@ -1739,7 +1739,7 @@ If wrapping a shared library with :mod:`!ctypes`, consider determining the
shared library name at development time, and hardcoding it into the wrapper
module instead of using :func:`!find_library` to locate the library
at runtime.
Also consider addding a configuration option or environment variable to let
Also consider adding a configuration option or environment variable to let
users select a library to use, and then perhaps use :func:`!find_library`
as a default or fallback.
@ -1760,11 +1760,10 @@ as a default or fallback.
(or by) Python.
It is recommended to only use this function as a default or fallback,
.. deprecated:: 3.15
.. soft-deprecated:: 3.15
This function is :term:`soft deprecated`.
It is kept for use in cases where it works, but not expected to be
updated for additional platforms and configurations.
This function is kept for use in cases where it works, but not expected to
be updated for additional platforms and configurations.
On Linux, :func:`!find_library` tries to run external
programs (``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the
@ -3195,8 +3194,8 @@ Arrays and pointers
Equivalent to ``type * length``, where *type* is a
:mod:`!ctypes` data type and *length* an integer.
This function is :term:`soft deprecated` in favor of multiplication.
There are no plans to remove it.
.. soft-deprecated:: 3.14
In favor of multiplication.
.. class:: _Pointer

View file

@ -371,8 +371,8 @@ Module contents
Converts the dataclass *obj* to a dict (by using the
factory function *dict_factory*). Each dataclass is converted
to a dict of its fields, as ``name: value`` pairs. dataclasses, dicts,
lists, and tuples are recursed into. Other objects are copied with
:func:`copy.deepcopy`.
frozendicts, lists, and tuples are recursed into. Other objects are copied
with :func:`copy.deepcopy`.
Example of using :func:`!asdict` on nested dataclasses::
@ -402,8 +402,8 @@ Module contents
Converts the dataclass *obj* to a tuple (by using the
factory function *tuple_factory*). Each dataclass is converted
to a tuple of its field values. dataclasses, dicts, lists, and
tuples are recursed into. Other objects are copied with
to a tuple of its field values. dataclasses, dicts, frozendicts, lists,
and tuples are recursed into. Other objects are copied with
:func:`copy.deepcopy`.
Continuing from the previous example::

View file

@ -400,7 +400,7 @@ operation is being performed, so the intermediate analysis object isn't useful:
.. versionchanged:: 3.10
The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the
:attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab`
:attr:`~codeobject.co_firstlineno` and :attr:`!codeobject.co_lnotab`
attributes of the :ref:`code object <code-objects>`.
.. versionchanged:: 3.13

View file

@ -403,11 +403,26 @@ added matters. To illustrate::
.. attribute:: utf8
If ``False``, follow :rfc:`5322`, supporting non-ASCII characters in
headers by encoding them as "encoded words". If ``True``, follow
:rfc:`6532` and use ``utf-8`` encoding for headers. Messages
headers by encoding them as :rfc:`2047` "encoded words". If ``True``,
follow :rfc:`6532` and use ``utf-8`` encoding for headers. Messages
formatted in this way may be passed to SMTP servers that support
the ``SMTPUTF8`` extension (:rfc:`6531`).
When ``False``, the generator will raise
:exc:`~email.errors.HeaderWriteError` if any header includes non-ASCII
characters in a context where :rfc:`2047` does not permit encoded words.
This particularly applies to mailboxes ("addr-spec") with non-ASCII
characters, which can be created via
:class:`~email.headerregistry.Address`. To use a mailbox with a non-ASCII
domain name with ``utf8=False``, first encode the domain using the
third-party :pypi:`idna` or :pypi:`uts46` module or with
:mod:`encodings.idna`. It is not possible to use a non-ASCII username
("local-part") in a mailbox when ``utf8=False``.
.. versionchanged:: 3.15
Can trigger the raising of :exc:`~email.errors.HeaderWriteError`.
(Earlier versions incorrectly applied :rfc:`2047` in certain contexts,
mostly notably in addr-specs.)
.. attribute:: refold_source

View file

@ -31,7 +31,8 @@ tracebacks:
* Each string is limited to 500 characters.
* Only the filename, the function name and the line number are
displayed. (no source code)
* It is limited to 100 frames and 100 threads.
* It is limited to 100 frames per thread, and 100 threads
(configurable via *max_threads*).
* The order is reversed: the most recent call is shown first.
By default, the Python traceback is written to :data:`sys.stderr`. To see
@ -55,16 +56,20 @@ at Python startup.
Dumping the traceback
---------------------
.. function:: dump_traceback(file=sys.stderr, all_threads=True)
.. function:: dump_traceback(file=sys.stderr, all_threads=True, *, max_threads=100)
Dump the tracebacks of all threads into *file*. If *all_threads* is
``False``, dump only the current thread.
``False``, dump only the current thread. *max_threads* caps the number
of threads dumped.
.. seealso:: :func:`traceback.print_tb`, which can be used to print a traceback object.
.. versionchanged:: 3.5
Added support for passing file descriptor to this function.
.. versionchanged:: next
Added the *max_threads* keyword argument.
Dumping the C stack
-------------------
@ -100,7 +105,7 @@ instead of the stack, even if the operating system supports dumping stacks.
Fault handler state
-------------------
.. function:: enable(file=sys.stderr, all_threads=True, c_stack=True)
.. function:: enable(file=sys.stderr, all_threads=True, c_stack=True, *, max_threads=100)
Enable the fault handler: install handlers for the :const:`~signal.SIGSEGV`,
:const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`
@ -116,6 +121,8 @@ Fault handler state
traceback, unless the system does not support it. See :func:`dump_c_stack` for
more information on compatibility.
*max_threads* caps the number of threads dumped when a fatal signal fires.
.. versionchanged:: 3.5
Added support for passing file descriptor to this function.
@ -133,6 +140,9 @@ Fault handler state
.. versionchanged:: 3.14
The dump now displays the C stack trace if *c_stack* is true.
.. versionchanged:: next
Added the *max_threads* keyword argument.
.. function:: disable()
Disable the fault handler: uninstall the signal handlers installed by
@ -146,7 +156,7 @@ Fault handler state
Dumping the tracebacks after a timeout
--------------------------------------
.. function:: dump_traceback_later(timeout, repeat=False, file=sys.stderr, exit=False)
.. function:: dump_traceback_later(timeout, repeat=False, file=sys.stderr, exit=False, *, max_threads=100)
Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or
every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, call
@ -154,7 +164,7 @@ Dumping the tracebacks after a timeout
:c:func:`!_exit` exits the process immediately, which means it doesn't do any
cleanup like flushing file buffers.) If the function is called twice, the new
call replaces previous parameters and resets the timeout. The timer has a
sub-second resolution.
sub-second resolution. *max_threads* caps the number of threads dumped.
The *file* must be kept open until the traceback is dumped or
:func:`cancel_dump_traceback_later` is called: see :ref:`issue with file
@ -168,6 +178,9 @@ Dumping the tracebacks after a timeout
.. versionchanged:: 3.7
This function is now always available.
.. versionchanged:: next
Added the *max_threads* keyword argument.
.. function:: cancel_dump_traceback_later()
Cancel the last call to :func:`dump_traceback_later`.
@ -176,11 +189,12 @@ Dumping the tracebacks after a timeout
Dumping the traceback on a user signal
--------------------------------------
.. function:: register(signum, file=sys.stderr, all_threads=True, chain=False)
.. function:: register(signum, file=sys.stderr, all_threads=True, chain=False, *, max_threads=100)
Register a user signal: install a handler for the *signum* signal to dump
the traceback of all threads, or of the current thread if *all_threads* is
``False``, into *file*. Call the previous handler if chain is ``True``.
*max_threads* caps the number of threads dumped.
The *file* must be kept open until the signal is unregistered by
:func:`unregister`: see :ref:`issue with file descriptors <faulthandler-fd>`.
@ -190,6 +204,9 @@ Dumping the traceback on a user signal
.. versionchanged:: 3.5
Added support for passing file descriptor to this function.
.. versionchanged:: next
Added the *max_threads* keyword argument.
.. function:: unregister(signum)
Unregister a user signal: uninstall the handler of the *signum* signal

View file

@ -19,13 +19,13 @@ are always available. They are listed here in alphabetical order.
| | :func:`ascii` | | :func:`filter` | | :func:`map` | | **S** |
| | | | :func:`float` | | :func:`max` | | |func-set|_ |
| | **B** | | :func:`format` | | |func-memoryview|_ | | :func:`setattr` |
| | :func:`bin` | | |func-frozenset|_ | | :func:`min` | | :func:`slice` |
| | :func:`bool` | | | | | | :func:`sorted` |
| | :func:`breakpoint` | | **G** | | **N** | | :func:`staticmethod` |
| | |func-bytearray|_ | | :func:`getattr` | | :func:`next` | | |func-str|_ |
| | |func-bytes|_ | | :func:`globals` | | | | :func:`sum` |
| | | | | | **O** | | :func:`super` |
| | **C** | | **H** | | :func:`object` | | |
| | :func:`bin` | | |func-frozenset|_ | | :func:`min` | | :func:`sentinel` |
| | :func:`bool` | | | | | | :func:`slice` |
| | :func:`breakpoint` | | **G** | | **N** | | :func:`sorted` |
| | |func-bytearray|_ | | :func:`getattr` | | :func:`next` | | :func:`staticmethod` |
| | |func-bytes|_ | | :func:`globals` | | | | |func-str|_ |
| | | | | | **O** | | :func:`sum` |
| | **C** | | **H** | | :func:`object` | | :func:`super` |
| | :func:`callable` | | :func:`hasattr` | | :func:`oct` | | **T** |
| | :func:`chr` | | :func:`hash` | | :func:`open` | | |func-tuple|_ |
| | :func:`classmethod` | | :func:`help` | | :func:`ord` | | :func:`type` |
@ -1827,6 +1827,63 @@ are always available. They are listed here in alphabetical order.
:func:`setattr`.
.. class:: sentinel(name, /)
Return a new unique sentinel object. *name* must be a :class:`str`, and is
used as the returned object's representation::
>>> MISSING = sentinel("MISSING")
>>> MISSING
MISSING
Sentinel objects are truthy and compare equal only to themselves. They are
intended to be compared with the :keyword:`is` operator.
``sentinel`` does not support subclassing.
Shallow and deep copies of a sentinel object return the object itself.
Sentinels are conventionally assigned to a variable with a matching name.
Sentinels defined in this way can be used in :term:`type hints <type hint>`::
MISSING = sentinel("MISSING")
def next_value(default: int | MISSING = MISSING):
...
Sentinel objects support the :ref:`| <bitwise>` operator for use in type expressions.
:mod:`Pickling <pickle>` is supported for sentinel objects that are
placed in the global scope of a module under a name matching the sentinel's
name, and for sentinels placed in class scopes with a name matching the
:term:`qualified name` of the sentinel. Other sentinels, such as those
defined in a function scope, are not picklable. The identity of the sentinel is preserved
after pickling::
import pickle
PICKLABLE = sentinel("PICKLABLE")
assert pickle.loads(pickle.dumps(PICKLABLE)) is PICKLABLE
class Cls:
PICKLABLE = sentinel("Cls.PICKLABLE")
assert pickle.loads(pickle.dumps(Cls.PICKLABLE)) is Cls.PICKLABLE
Sentinel objects have the following attributes:
.. attribute:: __name__
The sentinel's name.
.. attribute:: __module__
The name of the module where the sentinel was created.
.. versionadded:: next
.. class:: slice(stop, /)
slice(start, stop, step=None, /)

View file

@ -468,7 +468,7 @@ The :mod:`!functools` module defines the following functions:
Roughly equivalent to::
initial_missing = object()
initial_missing = sentinel('initial_missing')
def reduce(function, iterable, /, initial=initial_missing):
it = iter(iterable)

View file

@ -37,18 +37,11 @@ The :mod:`!gc` module provides the following functions:
.. function:: collect(generation=2)
Perform a collection. The optional argument *generation*
With no arguments, run a full collection. The optional argument *generation*
may be an integer specifying which generation to collect (from 0 to 2). A
:exc:`ValueError` is raised if the generation number is invalid. The sum of
collected objects and uncollectable objects is returned.
Calling ``gc.collect(0)`` will perform a GC collection on the young generation.
Calling ``gc.collect(1)`` will perform a GC collection on the young generation
and an increment of the old generation.
Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection
The free lists maintained for a number of built-in types are cleared
whenever a full collection or collection of the highest generation (2)
is run. Not all items in some free lists may be freed due to the
@ -60,6 +53,9 @@ The :mod:`!gc` module provides the following functions:
.. versionchanged:: 3.14
``generation=1`` performs an increment of collection.
.. versionchanged:: 3.14.5
``generation=1`` performs collection of the middle generation.
.. function:: set_debug(flags)
@ -75,13 +71,9 @@ The :mod:`!gc` module provides the following functions:
.. function:: get_objects(generation=None)
Returns a list of all objects tracked by the collector, excluding the list
returned. If *generation* is not ``None``, return only the objects as follows:
* 0: All objects in the young generation
* 1: No objects, as there is no generation 1 (as of Python 3.14)
* 2: All objects in the old generation
returned. If *generation* is not ``None``, return only the objects tracked by
the collector that are in that generation.
.. versionchanged:: 3.8
New *generation* parameter.
@ -89,6 +81,9 @@ The :mod:`!gc` module provides the following functions:
.. versionchanged:: 3.14
Generation 1 is removed
.. versionchanged:: 3.14.5
Generation 1 is reintroduced to maintain GC behavior from 3.13.
.. audit-event:: gc.get_objects generation gc.get_objects
.. function:: get_stats()
@ -124,33 +119,33 @@ The :mod:`!gc` module provides the following functions:
Set the garbage collection thresholds (the collection frequency). Setting
*threshold0* to zero disables collection.
The GC classifies objects into two generations depending on whether they have
survived a collection. New objects are placed in the young generation. If an
object survives a collection it is moved into the old generation.
In order to decide when to run, the collector keeps track of the number of object
The GC classifies objects into three generations depending on how many
collection sweeps they have survived. New objects are placed in the youngest
generation (generation ``0``). If an object survives a collection it is moved
into the next older generation. Since generation ``2`` is the oldest
generation, objects in that generation remain there after a collection. In
order to decide when to run, the collector keeps track of the number object
allocations and deallocations since the last collection. When the number of
allocations minus the number of deallocations exceeds *threshold0*, collection
starts. For each collection, all the objects in the young generation and some
fraction of the old generation is collected.
starts. Initially only generation ``0`` is examined. If generation ``0`` has
been examined more than *threshold1* times since generation ``1`` has been
examined, then generation ``1`` is examined as well.
With the third generation, things are a bit more complicated,
see `Collecting the oldest generation <https://github.com/python/cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/garbage_collector.md#collecting-the-oldest-generation>`_ for more information.
In the free-threaded build, the increase in process memory usage is also
checked before running the collector. If the memory usage has not increased
by 10% since the last collection and the net number of object allocations
has not exceeded 40 times *threshold0*, the collection is not run.
The fraction of the old generation that is collected is **inversely** proportional
to *threshold1*. The larger *threshold1* is, the slower objects in the old generation
are collected.
For the default value of 10, 1% of the old generation is scanned during each collection.
*threshold2* is ignored.
See `Garbage collector design <https://devguide.python.org/garbage_collector>`_ for more information.
See `Garbage collector design <https://github.com/python/cpython/blob/3.15/InternalDocs/garbage_collector.md>`_ for more information.
.. versionchanged:: 3.14
*threshold2* is ignored
.. versionchanged:: 3.14.5
*threshold2* is restored to match Python 3.13 behavior.
.. function:: get_count()

View file

@ -141,7 +141,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
argument is a list of ``(name, value)`` pairs containing the attributes found
inside the tag's ``<>`` brackets. The *name* will be translated to lower case,
and quotes in the *value* have been removed, and character and entity references
have been replaced.
have been replaced. For empty attributes, *value* is ``None``.
For instance, for the tag ``<A HREF="https://www.cwi.nl/">``, this method
would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])``.
@ -317,6 +317,18 @@ without further parsing:
Data : alert("<strong>hello! &#9786;</strong>");
End tag : script
Attribute names are converted to lowercase, quotes from attribute values removed,
and ``None`` is returned as *value* for empty attributes (such as ``checked``):
.. doctest::
>>> parser.feed("<input TYPE='checkbox' checked required='' disabled=disabled>")
Start tag: input
attr: ('type', 'checkbox')
attr: ('checked', None)
attr: ('required', '')
attr: ('disabled', 'disabled')
Parsing comments:
.. doctest::

View file

@ -25,10 +25,8 @@ The character set, :data:`string.ascii_letters`, :data:`string.digits` and
in a cookie name (as :attr:`~Morsel.key`).
.. versionchanged:: 3.3
Allowed '``:``' as a valid cookie name character.
Allowed ':' as a valid cookie name character.
.. versionchanged:: 3.15
Allowed '``"``' as a valid cookie value character.
.. note::
@ -313,10 +311,3 @@ The following example demonstrates how to use the :mod:`!http.cookies` module.
>>> print(C)
Set-Cookie: number=7
Set-Cookie: string=seven
>>> import json
>>> C = cookies.SimpleCookie()
>>> C.load(f'cookies=7; mixins="{json.dumps({"chips": "dark chocolate"})}"; state=gooey')
>>> print(C)
Set-Cookie: cookies=7
Set-Cookie: mixins="{"chips": "dark chocolate"}"
Set-Cookie: state=gooey

View file

@ -390,6 +390,14 @@ instantiation, of which this module provides three different variants:
This will be ``"SimpleHTTP/" + __version__``, where ``__version__`` is
defined at the module level.
.. attribute:: default_content_type
Specifies the Content-Type header value sent when the MIME type
cannot be guessed from the file extension of the requested URL.
By default, it is set to ``'application/octet-stream'``.
.. versionadded:: next
.. attribute:: extensions_map
A dictionary mapping suffixes into MIME types, contains custom overrides
@ -528,6 +536,18 @@ The following options are accepted:
.. versionadded:: 3.11
.. option:: --content-type <content_type>
Specifies the default Content-Type HTTP header used when the MIME type
cannot be guessed from the URL's file extension. By default, the server
uses ``'application/octet-stream'``:
.. code-block:: bash
python -m http.server --content-type text/html
.. versionadded:: next
.. option:: --tls-cert
Specifies a TLS certificate chain for HTTPS connections:

View file

@ -286,7 +286,7 @@ ABC hierarchy::
This method can potentially yield a very large number of objects, and
it may carry out IO operations when computing these values.
Because of this, it will generaly be desirable to compute the result
Because of this, it will generally be desirable to compute the result
values on-the-fly, as they are needed. As such, the returned object is
only guaranteed to be an :class:`iterable <collections.abc.Iterable>`,
instead of a :class:`list` or other
@ -340,7 +340,7 @@ ABC hierarchy::
This method can potentially yield a very large number of objects, and
it may carry out IO operations when computing these values.
Because of this, it will generaly be desirable to compute the result
Because of this, it will generally be desirable to compute the result
values on-the-fly, as they are needed. As such, the returned object is
only guaranteed to be an :class:`iterable <collections.abc.Iterable>`,
instead of a :class:`list` or other

View file

@ -195,10 +195,6 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
| | | read more :ref:`here |
| | | <inspect-module-co-flags>`|
+-----------------+-------------------+---------------------------+
| | co_lnotab | encoded mapping of line |
| | | numbers to bytecode |
| | | indices |
+-----------------+-------------------+---------------------------+
| | co_freevars | tuple of names of free |
| | | variables (referenced via |
| | | a function's closure) |

View file

@ -833,6 +833,7 @@ and :term:`generators <generator>` which incur interpreter overhead.
from collections import Counter, deque
from contextlib import suppress
from functools import reduce
from heapq import heappush, heappushpop, heappush_max, heappushpop_max
from math import comb, isqrt, prod, sumprod
from operator import getitem, is_not, itemgetter, mul, neg, truediv
@ -848,11 +849,6 @@ and :term:`generators <generator>` which incur interpreter overhead.
# prepend(1, [2, 3, 4]) → 1 2 3 4
return chain([value], iterable)
def running_mean(iterable):
"Yield the average of all values seen so far."
# running_mean([8.5, 9.5, 7.5, 6.5]) → 8.5 9.0 8.5 8.0
return map(truediv, accumulate(iterable), count(1))
def repeatfunc(function, times=None, *args):
"Repeat calls to a function with specified arguments."
if times is None:
@ -1150,6 +1146,49 @@ and :term:`generators <generator>` which incur interpreter overhead.
return n
# ==== Running statistics ====
def running_mean(iterable):
"Average of values seen so far."
# running_mean([37, 33, 38, 28]) → 37 35 36 34
return map(truediv, accumulate(iterable), count(1))
def running_min(iterable):
"Smallest of values seen so far."
# running_min([37, 33, 38, 28]) → 37 33 33 28
return accumulate(iterable, func=min)
def running_max(iterable):
"Largest of values seen so far."
# running_max([37, 33, 38, 28]) → 37 37 38 38
return accumulate(iterable, func=max)
def running_median(iterable):
"Median of values seen so far."
# running_median([37, 33, 38, 28]) → 37 35 37 35
read = iter(iterable).__next__
lo = [] # max-heap
hi = [] # min-heap the same size as or one smaller than lo
with suppress(StopIteration):
while True:
heappush_max(lo, heappushpop(hi, read()))
yield lo[0]
heappush(hi, heappushpop_max(lo, read()))
yield (lo[0] + hi[0]) / 2
def running_statistics(iterable):
"Aggregate statistics for values seen so far."
# Generate tuples: (size, minimum, median, maximum, mean)
t0, t1, t2, t3 = tee(iterable, 4)
return zip(
count(1),
running_min(t0),
running_median(t1),
running_max(t2),
running_mean(t3),
)
.. doctest::
:hide:
@ -1226,10 +1265,6 @@ and :term:`generators <generator>` which incur interpreter overhead.
[(0, 'a'), (1, 'b'), (2, 'c')]
>>> list(running_mean([8.5, 9.5, 7.5, 6.5]))
[8.5, 9.0, 8.5, 8.0]
>>> for _ in loops(5):
... print('hi')
...
@ -1789,6 +1824,28 @@ and :term:`generators <generator>` which incur interpreter overhead.
True
>>> list(running_mean([8.5, 9.5, 7.5, 6.5]))
[8.5, 9.0, 8.5, 8.0]
>>> list(running_mean([37, 33, 38, 28]))
[37.0, 35.0, 36.0, 34.0]
>>> list(running_min([37, 33, 38, 28]))
[37, 33, 33, 28]
>>> list(running_max([37, 33, 38, 28]))
[37, 37, 38, 38]
>>> list(running_median([37, 33, 38, 28]))
[37, 35.0, 37, 35.0]
>>> list(running_statistics([37, 33, 38, 28]))
[(1, 37, 37, 37, 37.0), (2, 33, 35.0, 37, 35.0), (3, 33, 37, 38, 36.0), (4, 28, 35.0, 38, 34.0)]
.. testcode::
:hide:

View file

@ -781,9 +781,8 @@ the following functions from the :mod:`math.integer` module:
Floats with integral values (like ``5.0``) are no longer accepted in the
:func:`factorial` function.
.. deprecated:: 3.15
These aliases are :term:`soft deprecated` in favor of the
:mod:`math.integer` functions.
.. soft-deprecated:: 3.15
Use the :mod:`math.integer` functions instead of these aliases.
Constants

View file

@ -54,8 +54,8 @@ the information :func:`init` sets up.
.. versionchanged:: 3.8
Added support for *url* being a :term:`path-like object`.
.. deprecated:: 3.13
Passing a file path instead of URL is :term:`soft deprecated`.
.. soft-deprecated:: 3.13
Passing a file path instead of URL.
Use :func:`guess_file_type` for this.

View file

@ -1336,12 +1336,12 @@ Connection objects are usually created using
Note that multiple connection objects may be polled at once by
using :func:`multiprocessing.connection.wait`.
.. method:: send_bytes(buffer[, offset[, size]])
.. method:: send_bytes(buf[, offset[, size]])
Send byte data from a :term:`bytes-like object` as a complete message.
If *offset* is given then data is read from that position in *buffer*. If
*size* is given then that many bytes will be read from buffer. Very large
If *offset* is given then data is read from that position in *buf*. If
*size* is given then that many bytes will be read from *buf*. Very large
buffers (approximately 32 MiB+, though it depends on the OS) may raise a
:exc:`ValueError` exception
@ -1361,18 +1361,18 @@ Connection objects are usually created using
alias of :exc:`OSError`.
.. method:: recv_bytes_into(buffer[, offset])
.. method:: recv_bytes_into(buf[, offset])
Read into *buffer* a complete message of byte data sent from the other end
Read into *buf* a complete message of byte data sent from the other end
of the connection and return the number of bytes in the message. Blocks
until there is something to receive. Raises
:exc:`EOFError` if there is nothing left to receive and the other end was
closed.
*buffer* must be a writable :term:`bytes-like object`. If
*buf* must be a writable :term:`bytes-like object`. If
*offset* is given then the message will be written into the buffer from
that position. Offset must be a non-negative integer less than the
length of *buffer* (in bytes).
length of *buf* (in bytes).
If the buffer is too short then a :exc:`BufferTooShort` exception is
raised and the complete message is available as ``e.args[0]`` where ``e``
@ -2917,6 +2917,16 @@ between themselves.
Suitable authentication keys can also be generated by using :func:`os.urandom`.
This authentication protects :class:`Listener` and :func:`Client` connections,
which are reachable by address. It is not applied to the anonymous pipes
created by :func:`~multiprocessing.Pipe` or used internally by
:class:`~multiprocessing.Queue`.
:mod:`multiprocessing` treats all local processes running as the same user as
trusted; on most operating systems such processes can access each other's pipe
file descriptors regardless. Applications that require isolation between
processes of the same user must arrange it at the operating-system level --
for example, by running workers under a different user account or in a sandbox.
Logging
^^^^^^^

View file

@ -5110,9 +5110,8 @@ written in Python, such as a mail server's external command delivery program.
Use :class:`subprocess.Popen` or :func:`subprocess.run` to
control options like encodings.
.. deprecated:: 3.14
The function is :term:`soft deprecated` and should no longer be used to
write new code. The :mod:`subprocess` module is recommended instead.
.. soft-deprecated:: 3.14
The :mod:`subprocess` module is recommended instead.
.. function:: posix_spawn(path, argv, env, *, file_actions=None, \
@ -5340,9 +5339,8 @@ written in Python, such as a mail server's external command delivery program.
.. versionchanged:: 3.6
Accepts a :term:`path-like object`.
.. deprecated:: 3.14
These functions are :term:`soft deprecated` and should no longer be used
to write new code. The :mod:`subprocess` module is recommended instead.
.. soft-deprecated:: 3.14
The :mod:`subprocess` module is recommended instead.
.. data:: P_NOWAIT

View file

@ -79,6 +79,9 @@ Command-line options
A pickle file to read, or ``-`` to indicate reading from standard input.
.. versionadded:: next
Output is in color by default and can be
:ref:`controlled using environment variables <using-on-controlling-color>`.
Programmatic interface

View file

@ -17,7 +17,7 @@
--------------
.. image:: tachyon-logo.png
.. image:: ../../Lib/profiling/sampling/_assets/tachyon-logo.png
:alt: Tachyon logo
:align: center
:width: 300px

View file

@ -931,7 +931,6 @@ Functions
.. function:: prefixmatch(pattern, string, flags=0)
.. function:: match(pattern, string, flags=0)
If zero or more characters at the beginning of *string* match the regular
expression *pattern*, return a corresponding :class:`~re.Match`. Return
@ -954,7 +953,11 @@ Functions
:func:`~re.match`. Use that name when you need to retain compatibility with
older Python versions.
.. deprecated:: 3.15
.. versionadded:: 3.15
.. function:: match(pattern, string, flags=0)
.. soft-deprecated:: 3.15
:func:`~re.match` has been :term:`soft deprecated` in favor of
the alternate :func:`~re.prefixmatch` name of this API which is
more explicitly descriptive. Use it to better
@ -1285,7 +1288,6 @@ Regular expression objects
.. method:: Pattern.prefixmatch(string[, pos[, endpos]])
.. method:: Pattern.match(string[, pos[, endpos]])
If zero or more characters at the *beginning* of *string* match this regular
expression, return a corresponding :class:`~re.Match`. Return ``None`` if the
@ -1310,7 +1312,11 @@ Regular expression objects
:meth:`~Pattern.match`. Use that name when you need to retain compatibility
with older Python versions.
.. deprecated:: 3.15
.. versionadded:: 3.15
.. method:: Pattern.match(string[, pos[, endpos]])
.. soft-deprecated:: 3.15
:meth:`~Pattern.match` has been :term:`soft deprecated` in favor of
the alternate :meth:`~Pattern.prefixmatch` name of this API which is
more explicitly descriptive. Use it to
@ -1794,8 +1800,8 @@ while new code should prefer :func:`!prefixmatch`.
.. versionadded:: 3.15
:func:`!prefixmatch`
.. deprecated:: 3.15
:func:`!match` is :term:`soft deprecated`
.. soft-deprecated:: 3.15
:func:`!match`
Making a phonebook
^^^^^^^^^^^^^^^^^^
@ -1947,7 +1953,7 @@ successive matches::
class Token(NamedTuple):
type: str
value: str
value: int | float | str
line: int
column: int

View file

@ -486,6 +486,7 @@ The AF_* and SOCK_* constants are now :class:`AddressFamily` and
.. versionchanged:: 3.15
``IPV6_HDRINCL`` was added.
Added support for ``SO_PASSRIGHTS`` on Linux platforms when available.
.. data:: AF_CAN

View file

@ -713,7 +713,7 @@ However, for reading convenience, most of the examples show sorted sequences.
.. function:: covariance(x, y, /)
Return the sample covariance of two inputs *x* and *y*. Covariance
Return the sample covariance of two sequence inputs *x* and *y*. Covariance
is a measure of the joint variability of two inputs.
Both inputs must be of the same length (no less than two), otherwise
@ -739,7 +739,7 @@ However, for reading convenience, most of the examples show sorted sequences.
Return the `Pearson's correlation coefficient
<https://en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_
for two inputs. Pearson's correlation coefficient *r* takes values
for two sequence inputs. Pearson's correlation coefficient *r* takes values
between -1 and +1. It measures the strength and direction of a linear
relationship.
@ -802,7 +802,7 @@ However, for reading convenience, most of the examples show sorted sequences.
(it is equal to the difference between predicted and actual values
of the dependent variable).
Both inputs must be of the same length (no less than two), and
Both inputs must be sequences of the same length (no less than two), and
the independent variable *x* cannot be constant;
otherwise a :exc:`StatisticsError` is raised.

View file

@ -227,32 +227,32 @@ platform-dependent.
+--------+--------------------------+--------------------+----------------+------------+
| ``c`` | :c:expr:`char` | bytes of length 1 | 1 | |
+--------+--------------------------+--------------------+----------------+------------+
| ``b`` | :c:expr:`signed char` | integer | 1 | \(1), \(2) |
| ``b`` | :c:expr:`signed char` | int | 1 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``B`` | :c:expr:`unsigned char` | integer | 1 | \(2) |
| ``B`` | :c:expr:`unsigned char` | int | 1 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``?`` | :c:expr:`_Bool` | bool | 1 | \(1) |
+--------+--------------------------+--------------------+----------------+------------+
| ``h`` | :c:expr:`short` | integer | 2 | \(2) |
| ``h`` | :c:expr:`short` | int | 2 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``H`` | :c:expr:`unsigned short` | integer | 2 | \(2) |
| ``H`` | :c:expr:`unsigned short` | int | 2 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``i`` | :c:expr:`int` | integer | 4 | \(2) |
| ``i`` | :c:expr:`int` | int | 4 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``I`` | :c:expr:`unsigned int` | integer | 4 | \(2) |
| ``I`` | :c:expr:`unsigned int` | int | 4 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``l`` | :c:expr:`long` | integer | 4 | \(2) |
| ``l`` | :c:expr:`long` | int | 4 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``L`` | :c:expr:`unsigned long` | integer | 4 | \(2) |
| ``L`` | :c:expr:`unsigned long` | int | 4 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``q`` | :c:expr:`long long` | integer | 8 | \(2) |
| ``q`` | :c:expr:`long long` | int | 8 | \(2) |
+--------+--------------------------+--------------------+----------------+------------+
| ``Q`` | :c:expr:`unsigned long | integer | 8 | \(2) |
| ``Q`` | :c:expr:`unsigned long | int | 8 | \(2) |
| | long` | | | |
+--------+--------------------------+--------------------+----------------+------------+
| ``n`` | :c:type:`ssize_t` | integer | | \(3) |
| ``n`` | :c:type:`ssize_t` | int | | \(2), \(3) |
+--------+--------------------------+--------------------+----------------+------------+
| ``N`` | :c:type:`size_t` | integer | | \(3) |
| ``N`` | :c:type:`size_t` | int | | \(2), \(3) |
+--------+--------------------------+--------------------+----------------+------------+
| ``e`` | :c:expr:`_Float16` | float | 2 | \(4), \(6) |
+--------+--------------------------+--------------------+----------------+------------+
@ -272,7 +272,7 @@ platform-dependent.
+--------+--------------------------+--------------------+----------------+------------+
| ``p`` | :c:expr:`char[]` | bytes | | \(8) |
+--------+--------------------------+--------------------+----------------+------------+
| ``P`` | :c:expr:`void \*` | integer | | \(5) |
| ``P`` | :c:expr:`void \*` | int | | \(2), \(5) |
+--------+--------------------------+--------------------+----------------+------------+
.. versionchanged:: 3.3
@ -349,27 +349,31 @@ Notes:
The ``'p'`` format character encodes a "Pascal string", meaning a short
variable-length string stored in a *fixed number of bytes*, given by the count.
The first byte stored is the length of the string, or 255, whichever is
smaller. The bytes of the string follow. If the string passed in to
smaller. The bytes of the string follow. If the byte string passed in to
:func:`pack` is too long (longer than the count minus 1), only the leading
``count-1`` bytes of the string are stored. If the string is shorter than
``count-1`` bytes of the string are stored. If the byte string is shorter than
``count-1``, it is padded with null bytes so that exactly count bytes in all
are used. Note that for :func:`unpack`, the ``'p'`` format character consumes
``count`` bytes, but that the string returned can never contain more than 255
``count`` bytes, but that the :class:`!bytes` object returned can never contain more than 255
bytes.
When packing, arguments of types :class:`bytes` and :class:`bytearray`
are accepted.
(9)
For the ``'s'`` format character, the count is interpreted as the length of the
bytes, not a repeat count like for the other format characters; for example,
byte string, not a repeat count like for the other format characters; for example,
``'10s'`` means a single 10-byte string mapping to or from a single
Python byte string, while ``'10c'`` means 10
separate one byte character elements (e.g., ``cccccccccc``) mapping
to or from ten different Python byte objects. (See :ref:`struct-examples`
for a concrete demonstration of the difference.)
If a count is not given, it defaults to 1. For packing, the string is
If a count is not given, it defaults to 1. For packing, the byte string is
truncated or padded with null bytes as appropriate to make it fit. For
unpacking, the resulting bytes object always has exactly the specified number
of bytes. As a special case, ``'0s'`` means a single, empty string (while
unpacking, the resulting :class:`!bytes` object always has exactly the specified number
of bytes. As a special case, ``'0s'`` means a single, empty byte string (while
``'0c'`` means 0 characters).
When packing, arguments of types :class:`bytes` and :class:`bytearray`
are accepted.
(10)
For the ``'F'`` and ``'D'`` format characters, the packed representation uses

View file

@ -180,8 +180,8 @@ Local events
''''''''''''
Local events are associated with normal execution of the program and happen
at clearly defined locations. All local events can be disabled.
The local events are:
at clearly defined locations. All local events can be disabled
per location. The local events are:
* :monitoring-event:`PY_START`
* :monitoring-event:`PY_RESUME`
@ -205,6 +205,8 @@ Using :monitoring-event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT`
events will give much better performance as they can be disabled
independently.
.. _monitoring-ancillary-events:
Ancillary events
''''''''''''''''
@ -226,7 +228,7 @@ Other events
''''''''''''
Other events are not necessarily tied to a specific location in the
program and cannot be individually disabled via :data:`DISABLE`.
program and cannot be individually disabled per location.
The other events that can be monitored are:
@ -234,6 +236,12 @@ The other events that can be monitored are:
* :monitoring-event:`PY_UNWIND`
* :monitoring-event:`RAISE`
* :monitoring-event:`EXCEPTION_HANDLED`
* :monitoring-event:`RERAISE`
.. versionchanged:: 3.15
Other events can now be turned on and disabled on a per code object
basis. Returning :data:`DISABLE` from a callback disables the event
for the entire code object (for the current tool).
The STOP_ITERATION event
@ -247,8 +255,7 @@ raise an exception unless it would be visible to other code.
To allow tools to monitor for real exceptions without slowing down generators
and coroutines, the :monitoring-event:`STOP_ITERATION` event is provided.
:monitoring-event:`STOP_ITERATION` can be locally disabled, unlike
:monitoring-event:`RAISE`.
:monitoring-event:`STOP_ITERATION` can be locally disabled.
Note that the :monitoring-event:`STOP_ITERATION` event and the
:monitoring-event:`RAISE` event for a :exc:`StopIteration` exception are
@ -314,15 +321,14 @@ location by returning :data:`sys.monitoring.DISABLE` from a callback function.
This does not change which events are set, or any other code locations for the
same event.
Disabling events for specific locations is very important for high
performance monitoring. For example, a program can be run under a
debugger with no overhead if the debugger disables all monitoring
except for a few breakpoints.
:ref:`Other events <monitoring-event-global>` can be disabled on a per code
object basis by returning :data:`sys.monitoring.DISABLE` from a callback
function. This disables the event for the entire code object (for the current
tool).
If :data:`DISABLE` is returned by a callback for a
:ref:`global event <monitoring-event-global>`, :exc:`ValueError` will be raised
by the interpreter in a non-specific location (that is, no traceback will be
provided).
Disabling events for specific locations is very important for high performance
monitoring. For example, a program can be run under a debugger with no overhead
if the debugger disables all monitoring except for a few breakpoints.
.. function:: restart_events() -> None

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

View file

@ -142,6 +142,10 @@ Some facts and figures:
a Zstandard dictionary used to improve compression of smaller amounts of
data.
For modes ``'w:gz'`` and ``'w|gz'``, :func:`tarfile.open` accepts the
keyword argument *mtime* to create a gzip archive header with that mtime. By
default, the mtime is set to the time of creation of the archive.
For special purposes, there is a second format for *mode*:
``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile`
object that processes its data as a stream of blocks. No random seeking will

View file

@ -1436,3 +1436,159 @@ is equivalent to::
Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`,
:class:`Semaphore`, and :class:`BoundedSemaphore` objects may be used as
:keyword:`with` statement context managers.
Iterator synchronization
------------------------
By default, Python iterators do not support concurrent access. Most iterators make
no guarantees when accessed simultaneously from multiple threads. Generator
iterators, for example, raise :exc:`ValueError` if one of their iterator methods
is called while the generator is already executing. The tools in this section
allow reliable concurrency support to be added to ordinary iterators and
iterator-producing callables.
The :class:`serialize_iterator` wrapper lets multiple threads share a single iterator and
take turns consuming from it. While one thread is running ``__next__()``, the
others block until the iterator becomes available. Each value produced by the
underlying iterator is delivered to exactly one caller.
The :func:`concurrent_tee` function lets multiple threads each receive the full
stream of values from one underlying iterator. It creates independent iterators
that all draw from the same source. Values are buffered until consumed by all
of the derived iterators.
.. class:: serialize_iterator(iterable)
Return an iterator wrapper that serializes concurrent calls to
:meth:`~iterator.__next__` using a lock.
If the wrapped iterator also defines :meth:`~generator.send`,
:meth:`~generator.throw`, or :meth:`~generator.close`, those calls
are serialized as well.
This makes it possible to share a single iterator, including a generator
iterator, between multiple threads. A lock ensures that calls are handled
one at a time. No values are duplicated or skipped by the wrapper itself.
Each item from the underlying iterator is given to exactly one caller.
This wrapper does not copy or buffer values. Threads that call
:func:`next` while another thread is already advancing the iterator will
block until the active call completes.
Example:
.. code-block:: python
import threading
def squares(n):
for x in range(n):
yield x * x
def consume(name, iterable):
for item in iterable:
print(name, item)
source = threading.serialize_iterator(squares(5))
t1 = threading.Thread(target=consume, args=("left", source))
t2 = threading.Thread(target=consume, args=("right", source))
t1.start()
t2.start()
t1.join()
t2.join()
In this example, each number is printed exactly once, but the work is shared
between the two threads.
.. versionadded:: next
.. function:: synchronized_iterator(func)
Wrap an iterator-producing callable so that each iterator it returns is
automatically passed through :class:`serialize_iterator`.
This is especially useful as a :term:`decorator` for generator functions,
allowing their generator-iterators to be consumed from multiple threads.
Example:
.. code-block:: python
import threading
@threading.synchronized_iterator
def squares(n):
for x in range(n):
yield x * x
def consume(name, iterable):
for item in iterable:
print(name, item)
source = squares(5)
t1 = threading.Thread(target=consume, args=("left", source))
t2 = threading.Thread(target=consume, args=("right", source))
t1.start()
t2.start()
t1.join()
t2.join()
The returned wrapper preserves the metadata of *func*, such as its name and
wrapped function reference.
.. versionadded:: next
.. function:: concurrent_tee(iterable, n=2)
Return *n* independent iterators from a single input *iterable*, with
guaranteed behavior when the derived iterators are consumed concurrently.
This function is similar to :func:`itertools.tee`, but is intended for cases
where the source iterator may feed consumers running in different threads.
Each returned iterator yields every value from the underlying iterable, in
the same order.
Internally, values are buffered until every derived iterator has consumed
them.
The returned iterators share the same underlying synchronization lock. Each
individual derived iterator is intended to be consumed by one thread at a
time. If a single derived iterator must itself be shared by multiple
threads, wrap it with :class:`serialize_iterator`.
If *n* is ``0``, return an empty tuple. If *n* is negative, raise
:exc:`ValueError`.
Example:
.. code-block:: python
import threading
def squares(n):
for x in range(n):
yield x * x
def consume(name, iterable):
for item in iterable:
print(name, item)
source = squares(5)
left, right = threading.concurrent_tee(source)
t1 = threading.Thread(target=consume, args=("left", left))
t2 = threading.Thread(target=consume, args=("right", right))
t1.start()
t2.start()
t1.join()
t2.join()
In this example, both consumer threads see the full sequence of squares
from a single generator expression.
.. versionadded:: next

View file

@ -28,7 +28,7 @@ type can be determined by checking the ``exact_type`` property on the
**undefined** when providing invalid Python code and it can change at any
point.
Tokenizing Input
Tokenizing input
----------------
The primary entry point is a :term:`generator`:
@ -146,7 +146,7 @@ function it uses to do this is available:
.. _tokenize-cli:
Command-Line Usage
Command-line usage
------------------
.. versionadded:: 3.3
@ -173,8 +173,12 @@ The following options are accepted:
If :file:`filename.py` is specified its contents are tokenized to stdout.
Otherwise, tokenization is performed on stdin.
.. versionadded:: next
Output is in color by default and can be
:ref:`controlled using environment variables <using-on-controlling-color>`.
Examples
------------------
--------
Example of a script rewriter that transforms float literals into Decimal
objects::
@ -227,7 +231,7 @@ Example of tokenizing from the command line. The script::
will be tokenized to the following output where the first column is the range
of the line/column coordinates where the token is found, the second column is
the name of the token, and the final column is the value of the token (if any)
the name of the token, and the final column is the value of the token (if any):
.. code-block:: shell-session

View file

@ -19,6 +19,12 @@ support writing TOML.
Added TOML 1.1.0 support.
See the :ref:`What's New <whatsnew315-tomllib-1-1-0>` for details.
.. warning::
Be cautious when parsing data from untrusted sources.
A malicious TOML string may cause the decoder to consume considerable
CPU and memory resources.
Limiting the size of data to be parsed is recommended.
.. seealso::

View file

@ -1174,7 +1174,8 @@ These can be used as types in annotations. They all support subscription using
or transforms parameters of another
callable. Usage is in the form
``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. ``Concatenate``
is currently only valid when used as the first argument to a :ref:`Callable <annotating-callables>`.
is valid when used in :ref:`Callable <annotating-callables>` type hints
and when instantiating user-defined generic classes with :class:`ParamSpec` parameters.
The last parameter to ``Concatenate`` must be a :class:`ParamSpec` or
ellipsis (``...``).
@ -1980,7 +1981,7 @@ without the dedicated syntax, as documented below.
.. _typevartuple:
.. class:: TypeVarTuple(name, *, default=typing.NoDefault)
.. class:: TypeVarTuple(name, *, bound=None, covariant=False, contravariant=False, infer_variance=False, default=typing.NoDefault)
Type variable tuple. A specialized form of :ref:`type variable <typevar>`
that enables *variadic* generics.
@ -2090,6 +2091,24 @@ without the dedicated syntax, as documented below.
The name of the type variable tuple.
.. attribute:: __covariant__
Whether the type variable tuple has been explicitly marked as covariant.
.. versionadded:: 3.15
.. attribute:: __contravariant__
Whether the type variable tuple has been explicitly marked as contravariant.
.. versionadded:: 3.15
.. attribute:: __infer_variance__
Whether the type variable tuple's variance should be inferred by type checkers.
.. versionadded:: 3.15
.. attribute:: __default__
The default value of the type variable tuple, or :data:`typing.NoDefault` if it
@ -2116,6 +2135,11 @@ without the dedicated syntax, as documented below.
.. versionadded:: 3.13
Type variable tuples created with ``covariant=True`` or
``contravariant=True`` can be used to declare covariant or contravariant
generic types. The ``bound`` argument is also accepted, similar to
:class:`TypeVar`, but its actual semantics are yet to be decided.
.. versionadded:: 3.11
.. versionchanged:: 3.12
@ -2127,6 +2151,11 @@ without the dedicated syntax, as documented below.
Support for default values was added.
.. versionchanged:: 3.15
Added support for the ``bound``, ``covariant``, ``contravariant``, and
``infer_variance`` parameters.
.. class:: ParamSpec(name, *, bound=None, covariant=False, contravariant=False, default=typing.NoDefault)
Parameter specification variable. A specialized version of
@ -2196,6 +2225,20 @@ without the dedicated syntax, as documented below.
The name of the parameter specification.
.. attribute:: __covariant__
Whether the parameter specification has been explicitly marked as covariant.
.. attribute:: __contravariant__
Whether the parameter specification has been explicitly marked as contravariant.
.. attribute:: __infer_variance__
Whether the parameter specification's variance should be inferred by type checkers.
.. versionadded:: 3.12
.. attribute:: __default__
The default value of the parameter specification, or :data:`typing.NoDefault` if it
@ -3358,6 +3401,36 @@ Functions and decorators
.. versionadded:: 3.12
.. decorator:: disjoint_base
Decorator to mark a class as a disjoint base.
Type checkers do not allow child classes of a disjoint base ``C`` to
inherit from other disjoint bases that are not parent or child classes of ``C``.
For example::
@disjoint_base
class Disjoint1: pass
@disjoint_base
class Disjoint2: pass
class Disjoint3(Disjoint1, Disjoint2): pass # Type checker error
Type checkers can use knowledge of disjoint bases to detect unreachable code
and determine when two types can overlap.
The corresponding runtime concept is a solid base (see :ref:`multiple-inheritance`).
Classes that are solid bases at runtime can be marked with ``@disjoint_base`` in stub files.
Users may also mark other classes as disjoint bases to indicate to type checkers that
multiple inheritance with other disjoint bases should not be allowed.
Note that the concept of a solid base is a CPython implementation
detail, and the exact set of standard library classes that are
disjoint bases at runtime may change in future versions of Python.
.. versionadded:: next
.. decorator:: type_check_only
@ -3380,13 +3453,13 @@ Functions and decorators
Introspection helpers
---------------------
.. function:: get_type_hints(obj, globalns=None, localns=None, include_extras=False)
.. function:: get_type_hints(obj, globalns=None, localns=None, include_extras=False, *, format=Format.VALUE)
Return a dictionary containing type hints for a function, method, module,
class object, or other callable object.
This is often the same as ``obj.__annotations__``, but this function makes
the following changes to the annotations dictionary:
This is often the same as :func:`annotationlib.get_annotations`, but this
function makes the following changes to the annotations dictionary:
* Forward references encoded as string literals or :class:`ForwardRef`
objects are handled by evaluating them in *globalns*, *localns*, and
@ -3400,17 +3473,15 @@ Introspection helpers
annotations from ``C``'s base classes with those on ``C`` directly. This
is done by traversing :attr:`C.__mro__ <type.__mro__>` and iteratively
combining
``__annotations__`` dictionaries. Annotations on classes appearing
earlier in the :term:`method resolution order` always take precedence over
annotations on classes appearing later in the method resolution order.
:term:`annotations <variable annotation>` of each base class. Annotations
on classes appearing earlier in the :term:`method resolution order` always
take precedence over annotations on classes appearing later in the method
resolution order.
* The function recursively replaces all occurrences of
``Annotated[T, ...]``, ``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]``
with ``T``, unless *include_extras* is set to ``True`` (see
:class:`Annotated` for more information).
See also :func:`annotationlib.get_annotations`, a lower-level function that
returns annotations more directly.
.. caution::
This function may execute arbitrary code contained in annotations.
@ -3418,11 +3489,12 @@ Introspection helpers
.. note::
If any forward references in the annotations of *obj* are not resolvable
or are not valid Python code, this function will raise an exception
such as :exc:`NameError`. For example, this can happen with imported
:ref:`type aliases <type-aliases>` that include forward references,
or with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`.
If :attr:`Format.VALUE <annotationlib.Format.VALUE>` is used and any
forward references in the annotations of *obj* are not resolvable, a
:exc:`NameError` exception is raised. For example, this can happen
with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`.
More generally, any kind of exception can be raised if an annotation
contains invalid Python code.
.. note::
@ -3440,6 +3512,10 @@ Introspection helpers
if a default value equal to ``None`` was set.
Now the annotation is returned unchanged.
.. versionchanged:: 3.14
Added the ``format`` parameter. See the documentation on
:func:`annotationlib.get_annotations` for more information.
.. versionchanged:: 3.14
Calling :func:`get_type_hints` on instances is no longer supported.
Some instances were accepted in earlier versions as an undocumented

View file

@ -308,6 +308,11 @@ Decompression objects support the following methods and attributes:
:attr:`unconsumed_tail`. This bytestring must be passed to a subsequent call to
:meth:`decompress` if decompression is to continue. If *max_length* is zero
then the whole input is decompressed, and :attr:`unconsumed_tail` is empty.
For example, the full content could be read like::
process_output(d.decompress(data, max_length))
while chunk := d.decompress(d.unconsumed_tail, max_length):
process_output(chunk)
.. versionchanged:: 3.6
*max_length* can be used as a keyword argument.

256
Doc/pylock.toml Normal file
View file

@ -0,0 +1,256 @@
# This file was autogenerated by uv via the following command:
# uv pip compile Doc/requirements.txt --exclude-newer P14D --exclude-newer-package linklint=PT0S --exclude-newer-package python-docs-theme=PT0S --no-cache --output-file Doc/pylock.toml --python-version 3.12 --universal
lock-version = "1.0"
created-by = "uv"
[[packages]]
name = "alabaster"
version = "1.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/a6/f8/d9c74d0daf3f742840fd818d69cfae176fa332022fd44e3469487d5a9420/alabaster-1.0.0.tar.gz", upload-time = 2024-07-26T18:15:03Z, size = 24210, hashes = { sha256 = "c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/7e/b3/6b4067be973ae96ba0d615946e314c5ae35f9f993eca561b356540bb0c2b/alabaster-1.0.0-py3-none-any.whl", upload-time = 2024-07-26T18:15:02Z, size = 13929, hashes = { sha256 = "fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b" } }]
[[packages]]
name = "babel"
version = "2.18.0"
sdist = { url = "https://files.pythonhosted.org/packages/7d/b2/51899539b6ceeeb420d40ed3cd4b7a40519404f9baf3d4ac99dc413a834b/babel-2.18.0.tar.gz", upload-time = 2026-02-01T12:30:56Z, size = 9959554, hashes = { sha256 = "b80b99a14bd085fcacfa15c9165f651fbb3406e66cc603abf11c5750937c992d" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/77/f5/21d2de20e8b8b0408f0681956ca2c69f1320a3848ac50e6e7f39c6159675/babel-2.18.0-py3-none-any.whl", upload-time = 2026-02-01T12:30:53Z, size = 10196845, hashes = { sha256 = "e2b422b277c2b9a9630c1d7903c2a00d0830c409c59ac8cae9081c92f1aeba35" } }]
[[packages]]
name = "blurb"
version = "2.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/d7/82/8597d891f4b03f3eaefcb4213a811643d558350cac9a69864d127832cc4f/blurb-2.0.0.tar.gz", upload-time = 2025-01-15T12:48:53Z, size = 24666, hashes = { sha256 = "c78d8114294225a4f7a2eabba6e05d36a6a50e45ba9f5a41afabc198350038e0" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/b4/03/374bd9e31b58e8a8e5dc65cc3f68ca7cdd716c32b5e5dcb0e1b76bb75b4a/blurb-2.0.0-py3-none-any.whl", upload-time = 2025-01-15T12:48:49Z, size = 18924, hashes = { sha256 = "f6d0e858dbe94765f6a89b8228217ffdb9c19cff08fc8f2c3153954846d31aa1" } }]
[[packages]]
name = "certifi"
version = "2026.2.25"
sdist = { url = "https://files.pythonhosted.org/packages/af/2d/7bf41579a8986e348fa033a31cdd0e4121114f6bce2457e8876010b092dd/certifi-2026.2.25.tar.gz", upload-time = 2026-02-25T02:54:17Z, size = 155029, hashes = { sha256 = "e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl", upload-time = 2026-02-25T02:54:15Z, size = 153684, hashes = { sha256 = "027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa" } }]
[[packages]]
name = "charset-normalizer"
version = "3.4.7"
sdist = { url = "https://files.pythonhosted.org/packages/e7/a1/67fe25fac3c7642725500a3f6cfe5821ad557c3abb11c9d20d12c7008d3e/charset_normalizer-3.4.7.tar.gz", upload-time = 2026-04-02T09:28:39Z, size = 144271, hashes = { sha256 = "ae89db9e5f98a11a4bf50407d4363e7b09b31e55bc117b4f7d80aab97ba009e5" } }
wheels = [
{ url = "https://files.pythonhosted.org/packages/0c/eb/4fc8d0a7110eb5fc9cc161723a34a8a6c200ce3b4fbf681bc86feee22308/charset_normalizer-3.4.7-cp312-cp312-macosx_10_13_universal2.whl", upload-time = 2026-04-02T09:26:24Z, size = 311328, hashes = { sha256 = "eca9705049ad3c7345d574e3510665cb2cf844c2f2dcfe675332677f081cbd46" } },
{ url = "https://files.pythonhosted.org/packages/f8/e3/0fadc706008ac9d7b9b5be6dc767c05f9d3e5df51744ce4cc9605de7b9f4/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", upload-time = 2026-04-02T09:26:25Z, size = 208061, hashes = { sha256 = "6178f72c5508bfc5fd446a5905e698c6212932f25bcdd4b47a757a50605a90e2" } },
{ url = "https://files.pythonhosted.org/packages/42/f0/3dd1045c47f4a4604df85ec18ad093912ae1344ac706993aff91d38773a2/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", upload-time = 2026-04-02T09:26:26Z, size = 229031, hashes = { sha256 = "e1421b502d83040e6d7fb2fb18dff63957f720da3d77b2fbd3187ceb63755d7b" } },
{ url = "https://files.pythonhosted.org/packages/dc/67/675a46eb016118a2fbde5a277a5d15f4f69d5f3f5f338e5ee2f8948fcf43/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", upload-time = 2026-04-02T09:26:28Z, size = 225239, hashes = { sha256 = "edac0f1ab77644605be2cbba52e6b7f630731fc42b34cb0f634be1a6eface56a" } },
{ url = "https://files.pythonhosted.org/packages/4b/f8/d0118a2f5f23b02cd166fa385c60f9b0d4f9194f574e2b31cef350ad7223/charset_normalizer-3.4.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", upload-time = 2026-04-02T09:26:29Z, size = 216589, hashes = { sha256 = "5649fd1c7bade02f320a462fdefd0b4bd3ce036065836d4f42e0de958038e116" } },
{ url = "https://files.pythonhosted.org/packages/b1/f1/6d2b0b261b6c4ceef0fcb0d17a01cc5bc53586c2d4796fa04b5c540bc13d/charset_normalizer-3.4.7-cp312-cp312-manylinux_2_31_armv7l.whl", upload-time = 2026-04-02T09:26:30Z, size = 202733, hashes = { sha256 = "203104ed3e428044fd943bc4bf45fa73c0730391f9621e37fe39ecf477b128cb" } },
{ url = "https://files.pythonhosted.org/packages/6f/c0/7b1f943f7e87cc3db9626ba17807d042c38645f0a1d4415c7a14afb5591f/charset_normalizer-3.4.7-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", upload-time = 2026-04-02T09:26:31Z, size = 212652, hashes = { sha256 = "298930cec56029e05497a76988377cbd7457ba864beeea92ad7e844fe74cd1f1" } },
{ url = "https://files.pythonhosted.org/packages/38/dd/5a9ab159fe45c6e72079398f277b7d2b523e7f716acc489726115a910097/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_aarch64.whl", upload-time = 2026-04-02T09:26:33Z, size = 211229, hashes = { sha256 = "708838739abf24b2ceb208d0e22403dd018faeef86ddac04319a62ae884c4f15" } },
{ url = "https://files.pythonhosted.org/packages/d5/ff/531a1cad5ca855d1c1a8b69cb71abfd6d85c0291580146fda7c82857caa1/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_armv7l.whl", upload-time = 2026-04-02T09:26:34Z, size = 203552, hashes = { sha256 = "0f7eb884681e3938906ed0434f20c63046eacd0111c4ba96f27b76084cd679f5" } },
{ url = "https://files.pythonhosted.org/packages/c1/4c/a5fb52d528a8ca41f7598cb619409ece30a169fbdf9cdce592e53b46c3a6/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_ppc64le.whl", upload-time = 2026-04-02T09:26:36Z, size = 230806, hashes = { sha256 = "4dc1e73c36828f982bfe79fadf5919923f8a6f4df2860804db9a98c48824ce8d" } },
{ url = "https://files.pythonhosted.org/packages/59/7a/071feed8124111a32b316b33ae4de83d36923039ef8cf48120266844285b/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_riscv64.whl", upload-time = 2026-04-02T09:26:37Z, size = 212316, hashes = { sha256 = "aed52fea0513bac0ccde438c188c8a471c4e0f457c2dd20cdbf6ea7a450046c7" } },
{ url = "https://files.pythonhosted.org/packages/fd/35/f7dba3994312d7ba508e041eaac39a36b120f32d4c8662b8814dab876431/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_s390x.whl", upload-time = 2026-04-02T09:26:38Z, size = 227274, hashes = { sha256 = "fea24543955a6a729c45a73fe90e08c743f0b3334bbf3201e6c4bc1b0c7fa464" } },
{ url = "https://files.pythonhosted.org/packages/8a/2d/a572df5c9204ab7688ec1edc895a73ebded3b023bb07364710b05dd1c9be/charset_normalizer-3.4.7-cp312-cp312-musllinux_1_2_x86_64.whl", upload-time = 2026-04-02T09:26:40Z, size = 218468, hashes = { sha256 = "bb6d88045545b26da47aa879dd4a89a71d1dce0f0e549b1abcb31dfe4a8eac49" } },
{ url = "https://files.pythonhosted.org/packages/86/eb/890922a8b03a568ca2f336c36585a4713c55d4d67bf0f0c78924be6315ca/charset_normalizer-3.4.7-cp312-cp312-win32.whl", upload-time = 2026-04-02T09:26:41Z, size = 148460, hashes = { sha256 = "2257141f39fe65a3fdf38aeccae4b953e5f3b3324f4ff0daf9f15b8518666a2c" } },
{ url = "https://files.pythonhosted.org/packages/35/d9/0e7dffa06c5ab081f75b1b786f0aefc88365825dfcd0ac544bdb7b2b6853/charset_normalizer-3.4.7-cp312-cp312-win_amd64.whl", upload-time = 2026-04-02T09:26:42Z, size = 159330, hashes = { sha256 = "5ed6ab538499c8644b8a3e18debabcd7ce684f3fa91cf867521a7a0279cab2d6" } },
{ url = "https://files.pythonhosted.org/packages/9e/5d/481bcc2a7c88ea6b0878c299547843b2521ccbc40980cb406267088bc701/charset_normalizer-3.4.7-cp312-cp312-win_arm64.whl", upload-time = 2026-04-02T09:26:44Z, size = 147828, hashes = { sha256 = "56be790f86bfb2c98fb742ce566dfb4816e5a83384616ab59c49e0604d49c51d" } },
{ url = "https://files.pythonhosted.org/packages/c1/3b/66777e39d3ae1ddc77ee606be4ec6d8cbd4c801f65e5a1b6f2b11b8346dd/charset_normalizer-3.4.7-cp313-cp313-macosx_10_13_universal2.whl", upload-time = 2026-04-02T09:26:45Z, size = 309627, hashes = { sha256 = "f496c9c3cc02230093d8330875c4c3cdfc3b73612a5fd921c65d39cbcef08063" } },
{ url = "https://files.pythonhosted.org/packages/2e/4e/b7f84e617b4854ade48a1b7915c8ccfadeba444d2a18c291f696e37f0d3b/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", upload-time = 2026-04-02T09:26:46Z, size = 207008, hashes = { sha256 = "0ea948db76d31190bf08bd371623927ee1339d5f2a0b4b1b4a4439a65298703c" } },
{ url = "https://files.pythonhosted.org/packages/c4/bb/ec73c0257c9e11b268f018f068f5d00aa0ef8c8b09f7753ebd5f2880e248/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", upload-time = 2026-04-02T09:26:48Z, size = 228303, hashes = { sha256 = "a277ab8928b9f299723bc1a2dabb1265911b1a76341f90a510368ca44ad9ab66" } },
{ url = "https://files.pythonhosted.org/packages/85/fb/32d1f5033484494619f701e719429c69b766bfc4dbc61aa9e9c8c166528b/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", upload-time = 2026-04-02T09:26:49Z, size = 224282, hashes = { sha256 = "3bec022aec2c514d9cf199522a802bd007cd588ab17ab2525f20f9c34d067c18" } },
{ url = "https://files.pythonhosted.org/packages/fa/07/330e3a0dda4c404d6da83b327270906e9654a24f6c546dc886a0eb0ffb23/charset_normalizer-3.4.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", upload-time = 2026-04-02T09:26:50Z, size = 215595, hashes = { sha256 = "e044c39e41b92c845bc815e5ae4230804e8e7bc29e399b0437d64222d92809dd" } },
{ url = "https://files.pythonhosted.org/packages/e3/7c/fc890655786e423f02556e0216d4b8c6bcb6bdfa890160dc66bf52dee468/charset_normalizer-3.4.7-cp313-cp313-manylinux_2_31_armv7l.whl", upload-time = 2026-04-02T09:26:52Z, size = 201986, hashes = { sha256 = "f495a1652cf3fbab2eb0639776dad966c2fb874d79d87ca07f9d5f059b8bd215" } },
{ url = "https://files.pythonhosted.org/packages/d8/97/bfb18b3db2aed3b90cf54dc292ad79fdd5ad65c4eae454099475cbeadd0d/charset_normalizer-3.4.7-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", upload-time = 2026-04-02T09:26:53Z, size = 211711, hashes = { sha256 = "e712b419df8ba5e42b226c510472b37bd57b38e897d3eca5e8cfd410a29fa859" } },
{ url = "https://files.pythonhosted.org/packages/6f/a5/a581c13798546a7fd557c82614a5c65a13df2157e9ad6373166d2a3e645d/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_aarch64.whl", upload-time = 2026-04-02T09:26:54Z, size = 210036, hashes = { sha256 = "7804338df6fcc08105c7745f1502ba68d900f45fd770d5bdd5288ddccb8a42d8" } },
{ url = "https://files.pythonhosted.org/packages/8c/bf/b3ab5bcb478e4193d517644b0fb2bf5497fbceeaa7a1bc0f4d5b50953861/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_armv7l.whl", upload-time = 2026-04-02T09:26:56Z, size = 202998, hashes = { sha256 = "481551899c856c704d58119b5025793fa6730adda3571971af568f66d2424bb5" } },
{ url = "https://files.pythonhosted.org/packages/e7/4e/23efd79b65d314fa320ec6017b4b5834d5c12a58ba4610aa353af2e2f577/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_ppc64le.whl", upload-time = 2026-04-02T09:26:57Z, size = 230056, hashes = { sha256 = "f59099f9b66f0d7145115e6f80dd8b1d847176df89b234a5a6b3f00437aa0832" } },
{ url = "https://files.pythonhosted.org/packages/b9/9f/1e1941bc3f0e01df116e68dc37a55c4d249df5e6fa77f008841aef68264f/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_riscv64.whl", upload-time = 2026-04-02T09:26:58Z, size = 211537, hashes = { sha256 = "f59ad4c0e8f6bba240a9bb85504faa1ab438237199d4cce5f622761507b8f6a6" } },
{ url = "https://files.pythonhosted.org/packages/80/0f/088cbb3020d44428964a6c97fe1edfb1b9550396bf6d278330281e8b709c/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_s390x.whl", upload-time = 2026-04-02T09:27:00Z, size = 226176, hashes = { sha256 = "3dedcc22d73ec993f42055eff4fcfed9318d1eeb9a6606c55892a26964964e48" } },
{ url = "https://files.pythonhosted.org/packages/6a/9f/130394f9bbe06f4f63e22641d32fc9b202b7e251c9aef4db044324dac493/charset_normalizer-3.4.7-cp313-cp313-musllinux_1_2_x86_64.whl", upload-time = 2026-04-02T09:27:02Z, size = 217723, hashes = { sha256 = "64f02c6841d7d83f832cd97ccf8eb8a906d06eb95d5276069175c696b024b60a" } },
{ url = "https://files.pythonhosted.org/packages/73/55/c469897448a06e49f8fa03f6caae97074fde823f432a98f979cc42b90e69/charset_normalizer-3.4.7-cp313-cp313-win32.whl", upload-time = 2026-04-02T09:27:03Z, size = 148085, hashes = { sha256 = "4042d5c8f957e15221d423ba781e85d553722fc4113f523f2feb7b188cc34c5e" } },
{ url = "https://files.pythonhosted.org/packages/5d/78/1b74c5bbb3f99b77a1715c91b3e0b5bdb6fe302d95ace4f5b1bec37b0167/charset_normalizer-3.4.7-cp313-cp313-win_amd64.whl", upload-time = 2026-04-02T09:27:04Z, size = 158819, hashes = { sha256 = "3946fa46a0cf3e4c8cb1cc52f56bb536310d34f25f01ca9b6c16afa767dab110" } },
{ url = "https://files.pythonhosted.org/packages/68/86/46bd42279d323deb8687c4a5a811fd548cb7d1de10cf6535d099877a9a9f/charset_normalizer-3.4.7-cp313-cp313-win_arm64.whl", upload-time = 2026-04-02T09:27:05Z, size = 147915, hashes = { sha256 = "80d04837f55fc81da168b98de4f4b797ef007fc8a79ab71c6ec9bc4dd662b15b" } },
{ url = "https://files.pythonhosted.org/packages/97/c8/c67cb8c70e19ef1960b97b22ed2a1567711de46c4ddf19799923adc836c2/charset_normalizer-3.4.7-cp314-cp314-macosx_10_15_universal2.whl", upload-time = 2026-04-02T09:27:07Z, size = 309234, hashes = { sha256 = "c36c333c39be2dbca264d7803333c896ab8fa7d4d6f0ab7edb7dfd7aea6e98c0" } },
{ url = "https://files.pythonhosted.org/packages/99/85/c091fdee33f20de70d6c8b522743b6f831a2f1cd3ff86de4c6a827c48a76/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", upload-time = 2026-04-02T09:27:08Z, size = 208042, hashes = { sha256 = "1c2aed2e5e41f24ea8ef1590b8e848a79b56f3a5564a65ceec43c9d692dc7d8a" } },
{ url = "https://files.pythonhosted.org/packages/87/1c/ab2ce611b984d2fd5d86a5a8a19c1ae26acac6bad967da4967562c75114d/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", upload-time = 2026-04-02T09:27:09Z, size = 228706, hashes = { sha256 = "54523e136b8948060c0fa0bc7b1b50c32c186f2fceee897a495406bb6e311d2b" } },
{ url = "https://files.pythonhosted.org/packages/a8/29/2b1d2cb00bf085f59d29eb773ce58ec2d325430f8c216804a0a5cd83cbca/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", upload-time = 2026-04-02T09:27:11Z, size = 224727, hashes = { sha256 = "715479b9a2802ecac752a3b0efa2b0b60285cf962ee38414211abdfccc233b41" } },
{ url = "https://files.pythonhosted.org/packages/47/5c/032c2d5a07fe4d4855fea851209cca2b6f03ebeb6d4e3afdb3358386a684/charset_normalizer-3.4.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", upload-time = 2026-04-02T09:27:12Z, size = 215882, hashes = { sha256 = "bd6c2a1c7573c64738d716488d2cdd3c00e340e4835707d8fdb8dc1a66ef164e" } },
{ url = "https://files.pythonhosted.org/packages/2c/c2/356065d5a8b78ed04499cae5f339f091946a6a74f91e03476c33f0ab7100/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_armv7l.whl", upload-time = 2026-04-02T09:27:13Z, size = 200860, hashes = { sha256 = "c45e9440fb78f8ddabcf714b68f936737a121355bf59f3907f4e17721b9d1aae" } },
{ url = "https://files.pythonhosted.org/packages/0c/cd/a32a84217ced5039f53b29f460962abb2d4420def55afabe45b1c3c7483d/charset_normalizer-3.4.7-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", upload-time = 2026-04-02T09:27:15Z, size = 211564, hashes = { sha256 = "3534e7dcbdcf757da6b85a0bbf5b6868786d5982dd959b065e65481644817a18" } },
{ url = "https://files.pythonhosted.org/packages/44/86/58e6f13ce26cc3b8f4a36b94a0f22ae2f00a72534520f4ae6857c4b81f89/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_aarch64.whl", upload-time = 2026-04-02T09:27:16Z, size = 211276, hashes = { sha256 = "e8ac484bf18ce6975760921bb6148041faa8fef0547200386ea0b52b5d27bf7b" } },
{ url = "https://files.pythonhosted.org/packages/8f/fe/d17c32dc72e17e155e06883efa84514ca375f8a528ba2546bee73fc4df81/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_armv7l.whl", upload-time = 2026-04-02T09:27:18Z, size = 201238, hashes = { sha256 = "a5fe03b42827c13cdccd08e6c0247b6a6d4b5e3cdc53fd1749f5896adcdc2356" } },
{ url = "https://files.pythonhosted.org/packages/6a/29/f33daa50b06525a237451cdb6c69da366c381a3dadcd833fa5676bc468b3/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_ppc64le.whl", upload-time = 2026-04-02T09:27:19Z, size = 230189, hashes = { sha256 = "2d6eb928e13016cea4f1f21d1e10c1cebd5a421bc57ddf5b1142ae3f86824fab" } },
{ url = "https://files.pythonhosted.org/packages/b6/6e/52c84015394a6a0bdcd435210a7e944c5f94ea1055f5cc5d56c5fe368e7b/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_riscv64.whl", upload-time = 2026-04-02T09:27:20Z, size = 211352, hashes = { sha256 = "e74327fb75de8986940def6e8dee4f127cc9752bee7355bb323cc5b2659b6d46" } },
{ url = "https://files.pythonhosted.org/packages/8c/d7/4353be581b373033fb9198bf1da3cf8f09c1082561e8e922aa7b39bf9fe8/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_s390x.whl", upload-time = 2026-04-02T09:27:22Z, size = 227024, hashes = { sha256 = "d6038d37043bced98a66e68d3aa2b6a35505dc01328cd65217cefe82f25def44" } },
{ url = "https://files.pythonhosted.org/packages/30/45/99d18aa925bd1740098ccd3060e238e21115fffbfdcb8f3ece837d0ace6c/charset_normalizer-3.4.7-cp314-cp314-musllinux_1_2_x86_64.whl", upload-time = 2026-04-02T09:27:23Z, size = 217869, hashes = { sha256 = "7579e913a5339fb8fa133f6bbcfd8e6749696206cf05acdbdca71a1b436d8e72" } },
{ url = "https://files.pythonhosted.org/packages/5c/05/5ee478aa53f4bb7996482153d4bfe1b89e0f087f0ab6b294fcf92d595873/charset_normalizer-3.4.7-cp314-cp314-win32.whl", upload-time = 2026-04-02T09:27:25Z, size = 148541, hashes = { sha256 = "5b77459df20e08151cd6f8b9ef8ef1f961ef73d85c21a555c7eed5b79410ec10" } },
{ url = "https://files.pythonhosted.org/packages/48/77/72dcb0921b2ce86420b2d79d454c7022bf5be40202a2a07906b9f2a35c97/charset_normalizer-3.4.7-cp314-cp314-win_amd64.whl", upload-time = 2026-04-02T09:27:26Z, size = 159634, hashes = { sha256 = "92a0a01ead5e668468e952e4238cccd7c537364eb7d851ab144ab6627dbbe12f" } },
{ url = "https://files.pythonhosted.org/packages/c6/a3/c2369911cd72f02386e4e340770f6e158c7980267da16af8f668217abaa0/charset_normalizer-3.4.7-cp314-cp314-win_arm64.whl", upload-time = 2026-04-02T09:27:28Z, size = 148384, hashes = { sha256 = "67f6279d125ca0046a7fd386d01b311c6363844deac3e5b069b514ba3e63c246" } },
{ url = "https://files.pythonhosted.org/packages/94/09/7e8a7f73d24dba1f0035fbbf014d2c36828fc1bf9c88f84093e57d315935/charset_normalizer-3.4.7-cp314-cp314t-macosx_10_15_universal2.whl", upload-time = 2026-04-02T09:27:29Z, size = 330133, hashes = { sha256 = "effc3f449787117233702311a1b7d8f59cba9ced946ba727bdc329ec69028e24" } },
{ url = "https://files.pythonhosted.org/packages/8d/da/96975ddb11f8e977f706f45cddd8540fd8242f71ecdb5d18a80723dcf62c/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", upload-time = 2026-04-02T09:27:30Z, size = 216257, hashes = { sha256 = "fbccdc05410c9ee21bbf16a35f4c1d16123dcdeb8a1d38f33654fa21d0234f79" } },
{ url = "https://files.pythonhosted.org/packages/e5/e8/1d63bf8ef2d388e95c64b2098f45f84758f6d102a087552da1485912637b/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", upload-time = 2026-04-02T09:27:32Z, size = 234851, hashes = { sha256 = "733784b6d6def852c814bce5f318d25da2ee65dd4839a0718641c696e09a2960" } },
{ url = "https://files.pythonhosted.org/packages/9b/40/e5ff04233e70da2681fa43969ad6f66ca5611d7e669be0246c4c7aaf6dc8/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", upload-time = 2026-04-02T09:27:34Z, size = 233393, hashes = { sha256 = "a89c23ef8d2c6b27fd200a42aa4ac72786e7c60d40efdc76e6011260b6e949c4" } },
{ url = "https://files.pythonhosted.org/packages/be/c1/06c6c49d5a5450f76899992f1ee40b41d076aee9279b49cf9974d2f313d5/charset_normalizer-3.4.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", upload-time = 2026-04-02T09:27:35Z, size = 223251, hashes = { sha256 = "6c114670c45346afedc0d947faf3c7f701051d2518b943679c8ff88befe14f8e" } },
{ url = "https://files.pythonhosted.org/packages/2b/9f/f2ff16fb050946169e3e1f82134d107e5d4ae72647ec8a1b1446c148480f/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_armv7l.whl", upload-time = 2026-04-02T09:27:36Z, size = 206609, hashes = { sha256 = "a180c5e59792af262bf263b21a3c49353f25945d8d9f70628e73de370d55e1e1" } },
{ url = "https://files.pythonhosted.org/packages/69/d5/a527c0cd8d64d2eab7459784fb4169a0ac76e5a6fc5237337982fd61347e/charset_normalizer-3.4.7-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", upload-time = 2026-04-02T09:27:38Z, size = 220014, hashes = { sha256 = "3c9a494bc5ec77d43cea229c4f6db1e4d8fe7e1bbffa8b6f0f0032430ff8ab44" } },
{ url = "https://files.pythonhosted.org/packages/7e/80/8a7b8104a3e203074dc9aa2c613d4b726c0e136bad1cc734594b02867972/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_aarch64.whl", upload-time = 2026-04-02T09:27:39Z, size = 218979, hashes = { sha256 = "8d828b6667a32a728a1ad1d93957cdf37489c57b97ae6c4de2860fa749b8fc1e" } },
{ url = "https://files.pythonhosted.org/packages/02/9a/b759b503d507f375b2b5c153e4d2ee0a75aa215b7f2489cf314f4541f2c0/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_armv7l.whl", upload-time = 2026-04-02T09:27:40Z, size = 209238, hashes = { sha256 = "cf1493cd8607bec4d8a7b9b004e699fcf8f9103a9284cc94962cb73d20f9d4a3" } },
{ url = "https://files.pythonhosted.org/packages/c2/4e/0f3f5d47b86bdb79256e7290b26ac847a2832d9a4033f7eb2cd4bcf4bb5b/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_ppc64le.whl", upload-time = 2026-04-02T09:27:42Z, size = 236110, hashes = { sha256 = "0c96c3b819b5c3e9e165495db84d41914d6894d55181d2d108cc1a69bfc9cce0" } },
{ url = "https://files.pythonhosted.org/packages/96/23/bce28734eb3ed2c91dcf93abeb8a5cf393a7b2749725030bb630e554fdd8/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_riscv64.whl", upload-time = 2026-04-02T09:27:43Z, size = 219824, hashes = { sha256 = "752a45dc4a6934060b3b0dab47e04edc3326575f82be64bc4fc293914566503e" } },
{ url = "https://files.pythonhosted.org/packages/2c/6f/6e897c6984cc4d41af319b077f2f600fc8214eb2fe2d6bcb79141b882400/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_s390x.whl", upload-time = 2026-04-02T09:27:45Z, size = 233103, hashes = { sha256 = "8778f0c7a52e56f75d12dae53ae320fae900a8b9b4164b981b9c5ce059cd1fcb" } },
{ url = "https://files.pythonhosted.org/packages/76/22/ef7bd0fe480a0ae9b656189ec00744b60933f68b4f42a7bb06589f6f576a/charset_normalizer-3.4.7-cp314-cp314t-musllinux_1_2_x86_64.whl", upload-time = 2026-04-02T09:27:46Z, size = 225194, hashes = { sha256 = "ce3412fbe1e31eb81ea42f4169ed94861c56e643189e1e75f0041f3fe7020abe" } },
{ url = "https://files.pythonhosted.org/packages/c5/a7/0e0ab3e0b5bc1219bd80a6a0d4d72ca74d9250cb2382b7c699c147e06017/charset_normalizer-3.4.7-cp314-cp314t-win32.whl", upload-time = 2026-04-02T09:27:48Z, size = 159827, hashes = { sha256 = "c03a41a8784091e67a39648f70c5f97b5b6a37f216896d44d2cdcb82615339a0" } },
{ url = "https://files.pythonhosted.org/packages/7a/1d/29d32e0fb40864b1f878c7f5a0b343ae676c6e2b271a2d55cc3a152391da/charset_normalizer-3.4.7-cp314-cp314t-win_amd64.whl", upload-time = 2026-04-02T09:27:49Z, size = 174168, hashes = { sha256 = "03853ed82eeebbce3c2abfdbc98c96dc205f32a79627688ac9a27370ea61a49c" } },
{ url = "https://files.pythonhosted.org/packages/de/32/d92444ad05c7a6e41fb2036749777c163baf7a0301a040cb672d6b2b1ae9/charset_normalizer-3.4.7-cp314-cp314t-win_arm64.whl", upload-time = 2026-04-02T09:27:51Z, size = 153018, hashes = { sha256 = "c35abb8bfff0185efac5878da64c45dafd2b37fb0383add1be155a763c1f083d" } },
{ url = "https://files.pythonhosted.org/packages/db/8f/61959034484a4a7c527811f4721e75d02d653a35afb0b6054474d8185d4c/charset_normalizer-3.4.7-py3-none-any.whl", upload-time = 2026-04-02T09:28:37Z, size = 61958, hashes = { sha256 = "3dce51d0f5e7951f8bb4900c257dad282f49190fdbebecd4ba99bcc41fef404d" } },
]
[[packages]]
name = "colorama"
version = "0.4.6"
marker = "sys_platform == 'win32'"
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", upload-time = 2022-10-25T02:36:22Z, size = 27697, hashes = { sha256 = "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", upload-time = 2022-10-25T02:36:20Z, size = 25335, hashes = { sha256 = "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6" } }]
[[packages]]
name = "docutils"
version = "0.21.2"
sdist = { url = "https://files.pythonhosted.org/packages/ae/ed/aefcc8cd0ba62a0560c3c18c33925362d46c6075480bfa4df87b28e169a9/docutils-0.21.2.tar.gz", upload-time = 2024-04-23T18:57:18Z, size = 2204444, hashes = { sha256 = "3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/8f/d7/9322c609343d929e75e7e5e6255e614fcc67572cfd083959cdef3b7aad79/docutils-0.21.2-py3-none-any.whl", upload-time = 2024-04-23T18:57:14Z, size = 587408, hashes = { sha256 = "dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2" } }]
[[packages]]
name = "idna"
version = "3.11"
sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", upload-time = 2025-10-12T14:55:20Z, size = 194582, hashes = { sha256 = "795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", upload-time = 2025-10-12T14:55:18Z, size = 71008, hashes = { sha256 = "771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea" } }]
[[packages]]
name = "imagesize"
version = "1.5.0"
sdist = { url = "https://files.pythonhosted.org/packages/cf/59/4b0dd64676aa6fb4986a755790cb6fc558559cf0084effad516820208ec3/imagesize-1.5.0.tar.gz", upload-time = 2026-03-03T01:59:54Z, size = 1281127, hashes = { sha256 = "8bfc5363a7f2133a89f0098451e0bcb1cd71aba4dc02bbcecb39d99d40e1b94f" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/1e/b1/a0662b03103c66cf77101a187f396ea91167cd9b7d5d3a2e465ad2c7ee9b/imagesize-1.5.0-py2.py3-none-any.whl", upload-time = 2026-03-03T01:59:52Z, size = 5763, hashes = { sha256 = "32677681b3f434c2cb496f00e89c5a291247b35b1f527589909e008057da5899" } }]
[[packages]]
name = "jinja2"
version = "3.1.6"
sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", upload-time = 2025-03-05T20:05:02Z, size = 245115, hashes = { sha256 = "0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", upload-time = 2025-03-05T20:05:00Z, size = 134899, hashes = { sha256 = "85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67" } }]
[[packages]]
name = "linklint"
version = "0.4.1"
sdist = { url = "https://files.pythonhosted.org/packages/61/bc/9972ace8643a04a74210942717fd20c1c34d96079b59fd7790b4db56df7d/linklint-0.4.1.tar.gz", upload-time = 2026-03-27T10:48:40Z, size = 20588, hashes = { sha256 = "a5d291a0d8a7ab8b1f96f62bb7e1d9d2c79d8eceb934e2efc0235d6b2e77f19b" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/af/88/9c4865cdbd6f73fff668706072c421a329de79c3b69e0aa511679a2ff4f3/linklint-0.4.1-py3-none-any.whl", upload-time = 2026-03-27T10:48:38Z, size = 12186, hashes = { sha256 = "78ff4d23ff3d3c62837fa34f0dcb909593dea52a2a1f426307264f081a8b41b5" } }]
[[packages]]
name = "markupsafe"
version = "2.1.5"
sdist = { url = "https://files.pythonhosted.org/packages/87/5b/aae44c6655f3801e81aa3eef09dbbf012431987ba564d7231722f68df02d/MarkupSafe-2.1.5.tar.gz", upload-time = 2024-02-02T16:31:22Z, size = 19384, hashes = { sha256 = "d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b" } }
wheels = [
{ url = "https://files.pythonhosted.org/packages/53/bd/583bf3e4c8d6a321938c13f49d44024dbe5ed63e0a7ba127e454a66da974/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", upload-time = 2024-02-02T16:30:33Z, size = 18215, hashes = { sha256 = "8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1" } },
{ url = "https://files.pythonhosted.org/packages/48/d6/e7cd795fc710292c3af3a06d80868ce4b02bfbbf370b7cee11d282815a2a/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", upload-time = 2024-02-02T16:30:34Z, size = 14069, hashes = { sha256 = "3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4" } },
{ url = "https://files.pythonhosted.org/packages/51/b5/5d8ec796e2a08fc814a2c7d2584b55f889a55cf17dd1a90f2beb70744e5c/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", upload-time = 2024-02-02T16:30:35Z, size = 29452, hashes = { sha256 = "ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee" } },
{ url = "https://files.pythonhosted.org/packages/0a/0d/2454f072fae3b5a137c119abf15465d1771319dfe9e4acbb31722a0fff91/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", upload-time = 2024-02-02T16:30:36Z, size = 28462, hashes = { sha256 = "f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5" } },
{ url = "https://files.pythonhosted.org/packages/2d/75/fd6cb2e68780f72d47e6671840ca517bda5ef663d30ada7616b0462ad1e3/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", upload-time = 2024-02-02T16:30:37Z, size = 27869, hashes = { sha256 = "ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b" } },
{ url = "https://files.pythonhosted.org/packages/b0/81/147c477391c2750e8fc7705829f7351cf1cd3be64406edcf900dc633feb2/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", upload-time = 2024-02-02T16:30:39Z, size = 33906, hashes = { sha256 = "d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a" } },
{ url = "https://files.pythonhosted.org/packages/8b/ff/9a52b71839d7a256b563e85d11050e307121000dcebc97df120176b3ad93/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", upload-time = 2024-02-02T16:30:40Z, size = 32296, hashes = { sha256 = "bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f" } },
{ url = "https://files.pythonhosted.org/packages/88/07/2dc76aa51b481eb96a4c3198894f38b480490e834479611a4053fbf08623/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", upload-time = 2024-02-02T16:30:42Z, size = 33038, hashes = { sha256 = "58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169" } },
{ url = "https://files.pythonhosted.org/packages/96/0c/620c1fb3661858c0e37eb3cbffd8c6f732a67cd97296f725789679801b31/MarkupSafe-2.1.5-cp312-cp312-win32.whl", upload-time = 2024-02-02T16:30:43Z, size = 16572, hashes = { sha256 = "8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad" } },
{ url = "https://files.pythonhosted.org/packages/3f/14/c3554d512d5f9100a95e737502f4a2323a1959f6d0d01e0d0997b35f7b10/MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", upload-time = 2024-02-02T16:30:44Z, size = 17127, hashes = { sha256 = "823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb" } },
]
[[packages]]
name = "packaging"
version = "24.2"
sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", upload-time = 2024-11-08T09:47:47Z, size = 163950, hashes = { sha256 = "c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", upload-time = 2024-11-08T09:47:44Z, size = 65451, hashes = { sha256 = "09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759" } }]
[[packages]]
name = "pygments"
version = "2.20.0"
sdist = { url = "https://files.pythonhosted.org/packages/c3/b2/bc9c9196916376152d655522fdcebac55e66de6603a76a02bca1b6414f6c/pygments-2.20.0.tar.gz", upload-time = 2026-03-29T13:29:33Z, size = 4955991, hashes = { sha256 = "6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/f4/7e/a72dd26f3b0f4f2bf1dd8923c85f7ceb43172af56d63c7383eb62b332364/pygments-2.20.0-py3-none-any.whl", upload-time = 2026-03-29T13:29:30Z, size = 1231151, hashes = { sha256 = "81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176" } }]
[[packages]]
name = "python-docs-theme"
version = "2026.4"
sdist = { url = "https://files.pythonhosted.org/packages/fd/59/dbb07775a15ddf9f7f8d5f6ef4cd4da5e8afd908cc27e6585bb132e6366a/python_docs_theme-2026.4.tar.gz", upload-time = 2026-04-19T18:35:13Z, size = 29782, hashes = { sha256 = "a815f80c5a09f734449eb2498fbcbad05340976a7a543e431f57de92218a9315" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/db/05/b9298eb9330c70a3d1465a6116ab01dad095538c2e574a2d704bb0002f4d/python_docs_theme-2026.4-py3-none-any.whl", upload-time = 2026-04-19T18:35:12Z, size = 73742, hashes = { sha256 = "f755d80ebe8d7aa4fad8ee964ff999635c72eebd24ab10928a0e9726363d65fc" } }]
[[packages]]
name = "requests"
version = "2.33.1"
sdist = { url = "https://files.pythonhosted.org/packages/5f/a4/98b9c7c6428a668bf7e42ebb7c79d576a1c3c1e3ae2d47e674b468388871/requests-2.33.1.tar.gz", upload-time = 2026-03-30T16:09:15Z, size = 134120, hashes = { sha256 = "18817f8c57c6263968bc123d237e3b8b08ac046f5456bd1e307ee8f4250d3517" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/d7/8e/7540e8a2036f79a125c1d2ebadf69ed7901608859186c856fa0388ef4197/requests-2.33.1-py3-none-any.whl", upload-time = 2026-03-30T16:09:13Z, size = 64947, hashes = { sha256 = "4e6d1ef462f3626a1f0a0a9c42dd93c63bad33f9f1c1937509b8c5c8718ab56a" } }]
[[packages]]
name = "roman-numerals"
version = "4.1.0"
sdist = { url = "https://files.pythonhosted.org/packages/ae/f9/41dc953bbeb056c17d5f7a519f50fdf010bd0553be2d630bc69d1e022703/roman_numerals-4.1.0.tar.gz", upload-time = 2025-12-17T18:25:34Z, size = 9077, hashes = { sha256 = "1af8b147eb1405d5839e78aeb93131690495fe9da5c91856cb33ad55a7f1e5b2" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/04/54/6f679c435d28e0a568d8e8a7c0a93a09010818634c3c3907fc98d8983770/roman_numerals-4.1.0-py3-none-any.whl", upload-time = 2025-12-17T18:25:33Z, size = 7676, hashes = { sha256 = "647ba99caddc2cc1e55a51e4360689115551bf4476d90e8162cf8c345fe233c7" } }]
[[packages]]
name = "roman-numerals-py"
version = "4.1.0"
sdist = { url = "https://files.pythonhosted.org/packages/cb/b5/de96fca640f4f656eb79bbee0e79aeec52e3e0e359f8a3e6a0d366378b64/roman_numerals_py-4.1.0.tar.gz", upload-time = 2025-12-17T18:25:41Z, size = 4274, hashes = { sha256 = "f5d7b2b4ca52dd855ef7ab8eb3590f428c0b1ea480736ce32b01fef2a5f8daf9" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/27/2c/daca29684cbe9fd4bc711f8246da3c10adca1ccc4d24436b17572eb2590e/roman_numerals_py-4.1.0-py3-none-any.whl", upload-time = 2025-12-17T18:25:40Z, size = 4547, hashes = { sha256 = "553114c1167141c1283a51743759723ecd05604a1b6b507225e91dc1a6df0780" } }]
[[packages]]
name = "snowballstemmer"
version = "2.2.0"
sdist = { url = "https://files.pythonhosted.org/packages/44/7b/af302bebf22c749c56c9c3e8ae13190b5b5db37a33d9068652e8f73b7089/snowballstemmer-2.2.0.tar.gz", upload-time = 2021-11-16T18:38:38Z, size = 86699, hashes = { sha256 = "09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/ed/dc/c02e01294f7265e63a7315fe086dd1df7dacb9f840a804da846b96d01b96/snowballstemmer-2.2.0-py2.py3-none-any.whl", upload-time = 2021-11-16T18:38:34Z, size = 93002, hashes = { sha256 = "c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a" } }]
[[packages]]
name = "sphinx"
version = "8.2.3"
sdist = { url = "https://files.pythonhosted.org/packages/38/ad/4360e50ed56cb483667b8e6dadf2d3fda62359593faabbe749a27c4eaca6/sphinx-8.2.3.tar.gz", upload-time = 2025-03-02T22:31:59Z, size = 8321876, hashes = { sha256 = "398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/31/53/136e9eca6e0b9dc0e1962e2c908fbea2e5ac000c2a2fbd9a35797958c48b/sphinx-8.2.3-py3-none-any.whl", upload-time = 2025-03-02T22:31:56Z, size = 3589741, hashes = { sha256 = "4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3" } }]
[[packages]]
name = "sphinx-notfound-page"
version = "1.0.4"
sdist = { url = "https://files.pythonhosted.org/packages/73/7d/c545883c714319380325a52c9f80d093c97e718d812fd8090e42b1a08508/sphinx_notfound_page-1.0.4.tar.gz", upload-time = 2024-07-31T12:29:21Z, size = 519228, hashes = { sha256 = "2a52f49cd367b5c4e64072de1591cc367714098500abf4ecb9a3ecb4fec25aae" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/87/c4/877a5beffb8dcaf35e919c4c3cad56732c76370d106126394f4ca211ad7f/sphinx_notfound_page-1.0.4-py3-none-any.whl", upload-time = 2024-07-31T12:29:18Z, size = 8170, hashes = { sha256 = "f7c26ae0df3cf3d6f38f56b068762e6203d0ebb7e1c804de1059598d7dd8b9d8" } }]
[[packages]]
name = "sphinxcontrib-applehelp"
version = "2.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/ba/6e/b837e84a1a704953c62ef8776d45c3e8d759876b4a84fe14eba2859106fe/sphinxcontrib_applehelp-2.0.0.tar.gz", upload-time = 2024-07-29T01:09:00Z, size = 20053, hashes = { sha256 = "2f29ef331735ce958efa4734873f084941970894c6090408b079c61b2e1c06d1" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/5d/85/9ebeae2f76e9e77b952f4b274c27238156eae7979c5421fba91a28f4970d/sphinxcontrib_applehelp-2.0.0-py3-none-any.whl", upload-time = 2024-07-29T01:08:58Z, size = 119300, hashes = { sha256 = "4cd3f0ec4ac5dd9c17ec65e9ab272c9b867ea77425228e68ecf08d6b28ddbdb5" } }]
[[packages]]
name = "sphinxcontrib-devhelp"
version = "2.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/f6/d2/5beee64d3e4e747f316bae86b55943f51e82bb86ecd325883ef65741e7da/sphinxcontrib_devhelp-2.0.0.tar.gz", upload-time = 2024-07-29T01:09:23Z, size = 12967, hashes = { sha256 = "411f5d96d445d1d73bb5d52133377b4248ec79db5c793ce7dbe59e074b4dd1ad" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/35/7a/987e583882f985fe4d7323774889ec58049171828b58c2217e7f79cdf44e/sphinxcontrib_devhelp-2.0.0-py3-none-any.whl", upload-time = 2024-07-29T01:09:21Z, size = 82530, hashes = { sha256 = "aefb8b83854e4b0998877524d1029fd3e6879210422ee3780459e28a1f03a8a2" } }]
[[packages]]
name = "sphinxcontrib-htmlhelp"
version = "2.1.0"
sdist = { url = "https://files.pythonhosted.org/packages/43/93/983afd9aa001e5201eab16b5a444ed5b9b0a7a010541e0ddfbbfd0b2470c/sphinxcontrib_htmlhelp-2.1.0.tar.gz", upload-time = 2024-07-29T01:09:37Z, size = 22617, hashes = { sha256 = "c9e2916ace8aad64cc13a0d233ee22317f2b9025b9cf3295249fa985cc7082e9" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/0a/7b/18a8c0bcec9182c05a0b3ec2a776bba4ead82750a55ff798e8d406dae604/sphinxcontrib_htmlhelp-2.1.0-py3-none-any.whl", upload-time = 2024-07-29T01:09:36Z, size = 98705, hashes = { sha256 = "166759820b47002d22914d64a075ce08f4c46818e17cfc9470a9786b759b19f8" } }]
[[packages]]
name = "sphinxcontrib-jsmath"
version = "1.0.1"
sdist = { url = "https://files.pythonhosted.org/packages/b2/e8/9ed3830aeed71f17c026a07a5097edcf44b692850ef215b161b8ad875729/sphinxcontrib-jsmath-1.0.1.tar.gz", upload-time = 2019-01-21T16:10:16Z, size = 5787, hashes = { sha256 = "a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/c2/42/4c8646762ee83602e3fb3fbe774c2fac12f317deb0b5dbeeedd2d3ba4b77/sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", upload-time = 2019-01-21T16:10:14Z, size = 5071, hashes = { sha256 = "2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178" } }]
[[packages]]
name = "sphinxcontrib-qthelp"
version = "2.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/68/bc/9104308fc285eb3e0b31b67688235db556cd5b0ef31d96f30e45f2e51cae/sphinxcontrib_qthelp-2.0.0.tar.gz", upload-time = 2024-07-29T01:09:56Z, size = 17165, hashes = { sha256 = "4fe7d0ac8fc171045be623aba3e2a8f613f8682731f9153bb2e40ece16b9bbab" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/27/83/859ecdd180cacc13b1f7e857abf8582a64552ea7a061057a6c716e790fce/sphinxcontrib_qthelp-2.0.0-py3-none-any.whl", upload-time = 2024-07-29T01:09:54Z, size = 88743, hashes = { sha256 = "b18a828cdba941ccd6ee8445dbe72ffa3ef8cbe7505d8cd1fa0d42d3f2d5f3eb" } }]
[[packages]]
name = "sphinxcontrib-serializinghtml"
version = "2.0.0"
sdist = { url = "https://files.pythonhosted.org/packages/3b/44/6716b257b0aa6bfd51a1b31665d1c205fb12cb5ad56de752dfa15657de2f/sphinxcontrib_serializinghtml-2.0.0.tar.gz", upload-time = 2024-07-29T01:10:09Z, size = 16080, hashes = { sha256 = "e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/52/a7/d2782e4e3f77c8450f727ba74a8f12756d5ba823d81b941f1b04da9d033a/sphinxcontrib_serializinghtml-2.0.0-py3-none-any.whl", upload-time = 2024-07-29T01:10:08Z, size = 92072, hashes = { sha256 = "6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331" } }]
[[packages]]
name = "sphinxext-opengraph"
version = "0.13.0"
sdist = { url = "https://files.pythonhosted.org/packages/f6/c0/eb6838e3bae624ce6c8b90b245d17e84252863150e95efdb88f92c8aa3fb/sphinxext_opengraph-0.13.0.tar.gz", upload-time = 2025-08-29T12:20:31Z, size = 1026875, hashes = { sha256 = "103335d08567ad8468faf1425f575e3b698e9621f9323949a6c8b96d9793e80b" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/bf/a4/66c1fd4f8fab88faf71cee04a945f9806ba0fef753f2cfc8be6353f64508/sphinxext_opengraph-0.13.0-py3-none-any.whl", upload-time = 2025-08-29T12:20:29Z, size = 1004152, hashes = { sha256 = "936c07828edc9ad9a7b07908b29596dc84ed0b3ceaa77acdf51282d232d4d80e" } }]
[[packages]]
name = "urllib3"
version = "2.6.3"
sdist = { url = "https://files.pythonhosted.org/packages/c7/24/5f1b3bdffd70275f6661c76461e25f024d5a38a46f04aaca912426a2b1d3/urllib3-2.6.3.tar.gz", upload-time = 2026-01-07T16:24:43Z, size = 435556, hashes = { sha256 = "1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed" } }
wheels = [{ url = "https://files.pythonhosted.org/packages/39/08/aaaad47bc4e9dc8c725e68f9d04865dbcb2052843ff09c97b08904852d84/urllib3-2.6.3-py3-none-any.whl", upload-time = 2026-01-07T16:24:42Z, size = 131584, hashes = { sha256 = "bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4" } }]

View file

@ -858,7 +858,7 @@ A literal pattern corresponds to most
: | "None"
: | "True"
: | "False"
signed_number: ["-"] NUMBER
signed_number: ["+" | "-"] NUMBER
The rule ``strings`` and the token ``NUMBER`` are defined in the
:doc:`standard Python grammar <./grammar>`. Triple-quoted strings are

View file

@ -926,6 +926,7 @@ Attribute assignment updates the module's namespace dictionary, e.g.,
single: __doc__ (module attribute)
single: __annotations__ (module attribute)
single: __annotate__ (module attribute)
single: __lazy_modules__ (module attribute)
pair: module; namespace
.. _import-mod-attrs:
@ -1121,6 +1122,20 @@ the following writable attributes:
.. versionadded:: 3.14
.. attribute:: module.__lazy_modules__
A container (an object implementing :meth:`~object.__contains__`) of fully
qualified module name strings. When defined
at module scope, any regular :keyword:`import` statement in that module whose
target module name appears in this container is treated as a
:ref:`lazy import <lazy-imports>`, as if the :keyword:`lazy` keyword had
been used. Imports inside functions, class bodies, or
:keyword:`try`/:keyword:`except`/:keyword:`finally` blocks are unaffected.
See :ref:`lazy-modules-compat` for details and examples.
.. versionadded:: 3.15
Module dictionaries
^^^^^^^^^^^^^^^^^^^
@ -1461,7 +1476,6 @@ indirectly) to mutable objects.
single: co_filename (code object attribute)
single: co_firstlineno (code object attribute)
single: co_flags (code object attribute)
single: co_lnotab (code object attribute)
single: co_name (code object attribute)
single: co_names (code object attribute)
single: co_nlocals (code object attribute)
@ -1534,14 +1548,6 @@ Special read-only attributes
* - .. attribute:: codeobject.co_firstlineno
- The line number of the first line of the function
* - .. attribute:: codeobject.co_lnotab
- A string encoding the mapping from :term:`bytecode` offsets to line
numbers. For details, see the source code of the interpreter.
.. deprecated:: 3.12
This attribute of code objects is deprecated, and may be removed in
Python 3.15.
* - .. attribute:: codeobject.co_stacksize
- The required stack size of the code object

View file

@ -920,6 +920,56 @@ See :pep:`810` for the full specification of lazy imports.
.. versionadded:: 3.15
.. _lazy-modules-compat:
Compatibility via ``__lazy_modules__``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. index::
single: __lazy_modules__
As an alternative to using the :keyword:`lazy` keyword, a module can opt
into lazy loading for specific imports by defining a module-level
:attr:`~module.__lazy_modules__` variable. When present, it must be a
container of fully qualified module name strings. Any regular (non-``lazy``)
:keyword:`import` statement at module scope whose target appears in
:attr:`!__lazy_modules__` is treated as a lazy import, exactly as if the
:keyword:`lazy` keyword had been used.
This provides a way to enable lazy loading for specific dependencies without
changing individual ``import`` statements. This is useful when supporting
Python versions older than 3.15 while using lazy imports in 3.15+::
__lazy_modules__ = ["json", "pathlib"]
import json # loaded lazily (name is in __lazy_modules__)
import os # loaded eagerly (name not in __lazy_modules__)
import pathlib # loaded lazily
Relative imports are resolved to their absolute name before the lookup, so
:attr:`!__lazy_modules__` must always contain fully qualified module names.
For ``from``-style imports, the relevant name is the module following
``from``, not the names of its members::
# In mypackage/mymodule.py
__lazy_modules__ = ["mypackage", "mypackage.sub.utils"]
from . import helper # loaded lazily: . resolves to mypackage
from .sub.utils import func # loaded lazily: .sub.utils resolves to mypackage.sub.utils
import json # loaded eagerly (not in __lazy_modules__)
Imports inside functions, class bodies, or
:keyword:`try`/:keyword:`except`/:keyword:`finally` blocks are always eager,
regardless of :attr:`!__lazy_modules__`.
Setting ``-X lazy_imports=none`` (or the :envvar:`PYTHON_LAZY_IMPORTS`
environment variable to ``none``) overrides :attr:`!__lazy_modules__` and
forces all imports to be eager.
.. versionadded:: 3.15
.. _future:
Future statements

View file

@ -2,8 +2,10 @@
from __future__ import annotations
from typing import TYPE_CHECKING
import re
from docutils import nodes
from sphinx import addnodes
from sphinx.domains.changeset import (
VersionChange,
versionlabel_classes,
@ -11,6 +13,7 @@
)
from sphinx.locale import _ as sphinx_gettext
TYPE_CHECKING = False
if TYPE_CHECKING:
from docutils.nodes import Node
from sphinx.application import Sphinx
@ -73,6 +76,76 @@ def run(self) -> list[Node]:
versionlabel_classes[self.name] = ""
class SoftDeprecated(PyVersionChange):
"""Directive for soft deprecations that auto-links to the glossary term.
Usage::
.. soft-deprecated:: 3.15
Use :func:`new_thing` instead.
Renders as: "Soft deprecated since version 3.15: Use new_thing() instead."
with "Soft deprecated" linking to the glossary definition.
"""
_TERM_RE = re.compile(r":term:`([^`]+)`")
def run(self) -> list[Node]:
versionlabels[self.name] = sphinx_gettext(
":term:`Soft deprecated` since version %s"
)
versionlabel_classes[self.name] = "soft-deprecated"
try:
result = super().run()
finally:
versionlabels[self.name] = ""
versionlabel_classes[self.name] = ""
for node in result:
# Add "versionchanged" class so existing theme CSS applies
node["classes"] = node.get("classes", []) + ["versionchanged"]
# Replace the plain-text "Soft deprecated" with a glossary reference
for inline in node.findall(nodes.inline):
if "versionmodified" in inline.get("classes", []):
self._add_glossary_link(inline)
return result
@classmethod
def _add_glossary_link(cls, inline: nodes.inline) -> None:
"""Replace :term:`soft deprecated` text with a cross-reference to the
'Soft deprecated' glossary entry."""
for child in inline.children:
if not isinstance(child, nodes.Text):
continue
text = str(child)
match = cls._TERM_RE.search(text)
if match is None:
continue
ref = addnodes.pending_xref(
"",
nodes.Text(match.group(1)),
refdomain="std",
reftype="term",
reftarget="soft deprecated",
refwarn=True,
)
start, end = match.span()
new_nodes: list[nodes.Node] = []
if start > 0:
new_nodes.append(nodes.Text(text[:start]))
new_nodes.append(ref)
if end < len(text):
new_nodes.append(nodes.Text(text[end:]))
child.parent.replace(child, new_nodes)
break
def setup(app: Sphinx) -> ExtensionMetadata:
# Override Sphinx's directives with support for 'next'
app.add_directive("versionadded", PyVersionChange, override=True)
@ -83,6 +156,9 @@ def setup(app: Sphinx) -> ExtensionMetadata:
# Register the ``.. deprecated-removed::`` directive
app.add_directive("deprecated-removed", DeprecatedRemoved)
# Register the ``.. soft-deprecated::`` directive
app.add_directive("soft-deprecated", SoftDeprecated)
return {
"version": "1.0",
"parallel_read_safe": True,

View file

@ -1 +1,7 @@
# HTML IDs excluded from the check-html-ids.py check.
# Remove from here in 3.16
c-api/allocation.html: deprecated-aliases
c-api/file.html: deprecated-api
library/asyncio-task.html: terminating-a-task-group

View file

@ -29,6 +29,7 @@
{% trans %}Deprecated since version %s, will be removed in version %s{% endtrans %}
{% trans %}Deprecated since version %s, removed in version %s{% endtrans %}
{% trans %}:term:`Soft deprecated` since version %s{% endtrans %}
In docsbuild-scripts, when rewriting indexsidebar.html with actual versions:

View file

@ -1,7 +1,7 @@
.. _tut-brieftourtwo:
**********************************************
Brief Tour of the Standard Library --- Part II
Brief tour of the standard library --- part II
**********************************************
This second tour covers more advanced modules that support professional
@ -10,7 +10,7 @@ programming needs. These modules rarely occur in small scripts.
.. _tut-output-formatting:
Output Formatting
Output formatting
=================
The :mod:`reprlib` module provides a version of :func:`repr` customized for
@ -130,7 +130,7 @@ templates for XML files, plain text reports, and HTML web reports.
.. _tut-binary-formats:
Working with Binary Data Record Layouts
Working with binary data record layouts
=======================================
The :mod:`struct` module provides :func:`~struct.pack` and
@ -178,14 +178,13 @@ tasks in background while the main program continues to run::
class AsyncZip(threading.Thread):
def __init__(self, infile, outfile):
threading.Thread.__init__(self)
super().__init__()
self.infile = infile
self.outfile = outfile
def run(self):
f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)
f.write(self.infile)
f.close()
with zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) as f:
f.write(self.infile)
print('Finished background zip of:', self.infile)
background = AsyncZip('mydata.txt', 'myarchive.zip')
@ -245,7 +244,7 @@ application.
.. _tut-weak-references:
Weak References
Weak references
===============
Python does automatic memory management (reference counting for most objects and
@ -286,7 +285,7 @@ applications include caching objects that are expensive to create::
.. _tut-list-tools:
Tools for Working with Lists
Tools for working with lists
============================
Many data structure needs can be met with the built-in list type. However,
@ -352,7 +351,7 @@ not want to run a full list sort::
.. _tut-decimal-fp:
Decimal Floating-Point Arithmetic
Decimal floating-point arithmetic
=================================
The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for

View file

@ -30,7 +30,7 @@ Adding Python to an Android app
Most app developers should use one of the following tools, which will provide a
much easier experience:
* `Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project
* `Briefcase <https://briefcase.beeware.org>`__, from the BeeWare project
* `Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project
* `Chaquopy <https://chaquo.com/chaquopy>`__
* `pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__

View file

@ -780,6 +780,24 @@ also be used to improve performance.
.. versionadded:: 3.14
.. option:: --without-frame-pointers
Disable frame pointers, which are enabled by default (see :pep:`831`).
By default, the build appends ``-fno-omit-frame-pointer`` (and
``-mno-omit-leaf-frame-pointer`` when the compiler supports it) to
``BASECFLAGS`` so profilers, debuggers, and system tracing tools
(``perf``, ``eBPF``, ``dtrace``, ``gdb``) can walk the C call stack
without DWARF metadata. The flags propagate to third-party C
extensions through :mod:`sysconfig`. On compilers that do not
understand them, the build silently skips them.
Downstream packagers and authors of native libraries built with
custom build systems should set the same flags so the unwind chain
stays unbroken across all native frames.
.. versionadded:: 3.15
.. option:: --without-mimalloc
Disable the fast :ref:`mimalloc <mimalloc>` allocator

View file

@ -402,7 +402,7 @@ Tracing events, with the correct line number, are generated for all lines of cod
The :attr:`~frame.f_lineno` attribute of frame objects will always contain the
expected line number.
The :attr:`~codeobject.co_lnotab` attribute of
The :attr:`!codeobject.co_lnotab` attribute of
:ref:`code objects <code-objects>` is deprecated and
will be removed in 3.12.
Code that needs to convert from offset to line number should use the new

View file

@ -1347,7 +1347,7 @@ Deprecated
``int``, convert to int explicitly: ``~int(x)``. (Contributed by Tim Hoffmann
in :gh:`103487`.)
* Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in
* Accessing :attr:`!codeobject.co_lnotab` on code objects was deprecated in
Python 3.10 via :pep:`626`,
but it only got a proper :exc:`DeprecationWarning` in 3.12.
May be removed in 3.15.

View file

@ -953,10 +953,24 @@ when a module is imported) will still emit the syntax warning.
(Contributed by Irit Katriel in :gh:`130080`.)
.. _incremental-garbage-collection:
.. _whatsnew314-incremental-gc:
Incremental garbage collection
------------------------------
Garbage collection
------------------
**From Python 3.14.5 onwards:**
The garbage collector (GC) has changed in Python 3.14.5.
Python 3.14.0-3.14.4 shipped with a new incremental GC.
However, due to a number of `reports
<https://github.com/python/cpython/issues/142516>`__
of significant memory pressure in production environments,
it has been reverted back to the generational GC from 3.13.
This is the GC now used in Python 3.14.5 and later.
**Previously in Python 3.14.0-3.14.4:**
The cycle garbage collector is now incremental.
This means that maximum pause times are reduced
@ -2203,7 +2217,18 @@ difflib
gc
--
* The new :ref:`incremental garbage collector <whatsnew314-incremental-gc>`
* **From Python 3.14.5 onwards:**
Python 3.14.0-3.14.4 shipped with a new incremental garbage collector.
However, due to a number of `reports
<https://github.com/python/cpython/issues/142516>`__
of significant memory pressure in production environments,
it has been reverted back to the generational GC from 3.13.
This is the GC now used in Python 3.14.5 and later.
* **Previously in Python 3.14.0-3.14.4:**
The new :ref:`incremental garbage collector <whatsnew314-incremental-gc>`
means that maximum pause times are reduced
by an order of magnitude or more for larger heaps.
@ -3447,3 +3472,17 @@ Changes in the C API
functions on Python 3.13 and older.
.. _pythoncapi-compat project: https://github.com/python/pythoncapi-compat/
Notable changes in 3.14.5
=========================
gc
--
* The incremental garbage collector shipped in Python 3.14.0-3.14.4 has been
reverted back to the generational garbage collector from 3.13,
due to a number of `reports
<https://github.com/python/cpython/issues/142516>`__
of significant memory pressure in production environments.
See :ref:`whatsnew314-incremental-gc` for details.

View file

@ -69,6 +69,8 @@ Summary -- Release highlights
<whatsnew315-lazy-imports>`
* :pep:`814`: :ref:`Add frozendict built-in type
<whatsnew315-frozendict>`
* :pep:`661`: :ref:`Add sentinel built-in type
<whatsnew315-sentinel>`
* :pep:`799`: :ref:`A dedicated profiling package for organizing Python
profiling tools <whatsnew315-profiling-package>`
* :pep:`799`: :ref:`Tachyon: High frequency statistical sampling profiler
@ -80,9 +82,11 @@ Summary -- Release highlights
* :pep:`728`: ``TypedDict`` with typed extra items
* :pep:`747`: :ref:`Annotating type forms with TypeForm
<whatsnew315-typeform>`
* :pep:`800`: Disjoint bases in the type system
* :pep:`782`: :ref:`A new PyBytesWriter C API to create a Python bytes object
<whatsnew315-pybyteswriter>`
* :pep:`803`: :ref:`Stable ABI for Free-Threaded Builds <whatsnew315-abi3t>`
* :pep:`831`: :ref:`Frame pointers everywhere <whatsnew315-frame-pointers>`
* :ref:`The JIT compiler has been significantly upgraded <whatsnew315-jit>`
* :ref:`Improved error messages <whatsnew315-improved-error-messages>`
* :ref:`The official Windows 64-bit binaries now use the tail-calling interpreter
@ -141,7 +145,7 @@ In the case where loading a lazily imported module fails (for example, if
the module does not exist), Python raises the exception at the point of
first use rather than at import time. The associated traceback includes both
the location where the name was accessed and the original import statement,
making it straightforward to diagnose & debug the failure.
making it straightforward to diagnose and debug the failure.
For cases where you want to enable lazy loading globally without modifying
source code, Python provides the :option:`-X lazy_imports <-X>` command-line
@ -183,6 +187,18 @@ function, class body, or ``try``/``except``/``finally`` block raises a
(``lazy from module import *`` and ``lazy from __future__ import ...`` both
raise :exc:`SyntaxError`).
For code that cannot use the ``lazy`` keyword directly (for example, when
supporting Python versions older than 3.15 while still using lazy
imports on 3.15+), a module can define
:attr:`~module.__lazy_modules__` as a container of fully qualified module
name strings. Regular ``import`` statements for those modules are then treated
as lazy, with the same semantics as the ``lazy`` keyword::
__lazy_modules__ = ["json", "pathlib"]
import json # lazy
import os # still eager
.. seealso:: :pep:`810` for the full specification and rationale.
(Contributed by Pablo Galindo Salgado and Dino Viehland in :gh:`142349`.)
@ -234,6 +250,20 @@ to accept also other mapping types such as :class:`~types.MappingProxyType`.
(Contributed by Victor Stinner and Donghee Na in :gh:`141510`.)
.. _whatsnew315-sentinel:
:pep:`661`: Add sentinel built-in type
--------------------------------------
A new :class:`sentinel` type is added to the :mod:`builtins` module for
creating unique sentinel values with a concise representation. Sentinel
objects preserve identity when copied, support use in type expressions with
the ``|`` operator, and can be pickled when they are importable by module and
name.
(PEP by Tal Einat; contributed by Jelle Zijlstra in :gh:`148829`.)
.. _whatsnew315-profiling-package:
:pep:`799`: A dedicated profiling package
@ -259,7 +289,7 @@ The :mod:`profile` module is deprecated and will be removed in Python 3.17.
Tachyon: High frequency statistical sampling profiler
-----------------------------------------------------
.. image:: ../library/tachyon-logo.png
.. image:: ../../Lib/profiling/sampling/_assets/tachyon-logo.png
:alt: Tachyon profiler logo
:align: center
:width: 200px
@ -450,14 +480,36 @@ Improved error messages
Running this code now produces a clearer suggestion:
.. code-block:: pycon
.. code-block:: pytb
Traceback (most recent call last):
File "/home/pablogsal/github/python/main/lel.py", line 42, in <module>
print(container.area)
^^^^^^^^^^^^^^
File "/home/pablogsal/github/python/main/lel.py", line 42, in <module>
print(container.area)
^^^^^^^^^^^^^^
AttributeError: 'Container' object has no attribute 'area'. Did you mean '.inner.area' instead of '.area'?
* The interpreter now tries to provide a suggestion when
:func:`delattr` fails due to a missing attribute.
When an attribute name that closely resembles an existing attribute is used,
the interpreter will suggest the correct attribute name in the error message.
For example:
.. doctest::
>>> class A:
... pass
>>> a = A()
>>> a.abcde = 1
>>> del a.abcdf # doctest: +ELLIPSIS
Traceback (most recent call last):
...
AttributeError: 'A' object has no attribute 'abcdf'. Did you mean: 'abcde'?
(Contributed by Nikita Sobolev and Pranjal Prajapati in :gh:`136588`.)
* Several error messages incorrectly using the term "argument" have been corrected.
(Contributed by Stan Ulbrych in :gh:`133382`.)
Other language changes
======================
@ -489,28 +541,6 @@ Other language changes
(Contributed by Adam Turner in :gh:`133711`; PEP 686 written by Inada Naoki.)
* Several error messages incorrectly using the term "argument" have been corrected.
(Contributed by Stan Ulbrych in :gh:`133382`.)
* The interpreter now tries to provide a suggestion when
:func:`delattr` fails due to a missing attribute.
When an attribute name that closely resembles an existing attribute is used,
the interpreter will suggest the correct attribute name in the error message.
For example:
.. doctest::
>>> class A:
... pass
>>> a = A()
>>> a.abcde = 1
>>> del a.abcdf # doctest: +ELLIPSIS
Traceback (most recent call last):
...
AttributeError: 'A' object has no attribute 'abcdf'. Did you mean: 'abcde'?
(Contributed by Nikita Sobolev and Pranjal Prajapati in :gh:`136588`.)
* Unraisable exceptions are now highlighted with color by default. This can be
controlled by :ref:`environment variables <using-on-controlling-color>`.
(Contributed by Peter Bierma in :gh:`134170`.)
@ -644,6 +674,17 @@ Other language changes
* Allow the *count* argument of :meth:`bytes.replace` to be a keyword.
(Contributed by Stan Ulbrych in :gh:`147856`.)
* Unary plus is now accepted in :keyword:`match` literal patterns, mirroring
the existing support for unary minus.
(Contributed by Bartosz Sławecki in :gh:`145239`.)
* The import system now acquires per-module locks in hierarchical order
(parent packages before their submodules). This fixes a long-standing
deadlock where one thread importing ``pkg.sub`` and another importing
``pkg.sub.mod`` could each block the other when ``pkg/sub/__init__.py``
imports ``pkg.sub.mod``.
(Contributed by Gregory P. Smith in :gh:`83065`.)
New modules
===========
@ -692,6 +733,31 @@ array
(Contributed by Victor Stinner in :gh:`148675`.)
ast
---
* Add *color* parameter to :func:`~ast.dump`.
If ``True``, the returned string is syntax highlighted using ANSI escape
sequences.
If ``False`` (the default), colored output is always disabled.
(Contributed by Stan Ulbrych in :gh:`148981`.)
* The :ref:`command-line <ast-cli>` output is now syntax highlighted by default.
This can be :ref:`controlled using environment variables <using-on-controlling-color>`.
(Contributed by Stan Ulbrych in :gh:`148981`.)
asyncio
-------
* Added :meth:`TaskGroup.cancel <asyncio.TaskGroup.cancel>` to allow early
termination of a task group, for instance, when the goal of the tasks has
been achieved or their services are no longer needed.
Previously this would involve unintuitive boilerplate such as an extra task
raising a custom exception which is then suppressed as it exits the task group.
(Contributed by John Belmonte in :gh:`127214`.)
base64
------
@ -712,11 +778,20 @@ base64
(Contributed by Serhiy Storchaka in :gh:`143214` and :gh:`146431`.)
* Added the *ignorechars* parameter in :func:`~base64.b16decode`,
:func:`~base64.b32decode`, :func:`~base64.b32hexdecode`,
:func:`~base64.b32decode`, :func:`~base64.b32hexdecode`,
:func:`~base64.b64decode`, :func:`~base64.b85decode`, and
:func:`~base64.z85decode`.
(Contributed by Serhiy Storchaka in :gh:`144001` and :gh:`146431`.)
* Added the *canonical* parameter in
:func:`~base64.b32decode`, :func:`~base64.b32hexdecode`,
:func:`~base64.b64decode`, :func:`~base64.urlsafe_b64decode`,
:func:`~base64.a85decode`, :func:`~base64.b85decode`, and
:func:`~base64.z85decode`,
to reject encodings with non-zero padding bits or other non-canonical
forms.
(Contributed by Gregory P. Smith in :gh:`146311`.)
binascii
--------
@ -750,6 +825,10 @@ binascii
:func:`~binascii.unhexlify`, and :func:`~binascii.a2b_base64`.
(Contributed by Serhiy Storchaka in :gh:`144001` and :gh:`146431`.)
* Added the *canonical* parameter in :func:`~binascii.a2b_base64`,
to reject encodings with non-zero padding bits.
(Contributed by Gregory P. Smith in :gh:`146311`.)
calendar
--------
@ -791,6 +870,15 @@ contextlib
consistency with the :keyword:`with` and :keyword:`async with` statements.
(Contributed by Serhiy Storchaka in :gh:`144386`.)
* :class:`~contextlib.ContextDecorator` and
:class:`~contextlib.AsyncContextDecorator` (and therefore
:func:`~contextlib.contextmanager` and :func:`~contextlib.asynccontextmanager`
used as decorators) now detect generator functions, coroutine functions, and
asynchronous generator functions and keep the context manager open across
iteration or await. Previously the context manager exited as soon as the
generator or coroutine object was created.
(Contributed by Alex Grönholm & Gregory P. Smith in :gh:`125862`.)
dataclasses
-----------
@ -823,6 +911,25 @@ difflib
(Contributed by Jiahao Li in :gh:`134580`.)
faulthandler
------------
* Added the *max_threads* parameter in :func:`faulthandler.enable`,
:func:`faulthandler.dump_traceback`, :func:`faulthandler.dump_traceback_later`,
and :func:`faulthandler.register`.
(Contributed by Eric Froemling in :gh:`149085`.)
email
-----
* Email generators now raise an error when an :class:`.EmailMessage` cannot be
accurately flattened due to a non-ASCII email address (mailbox) in an address
header. Options for supporting Email Address Internationalization (EAI) are
discussed in :attr:`.EmailPolicy.utf8`.
(Contributed by R David Murray and Mike Edmunds in :gh:`122540`.)
functools
---------
@ -856,13 +963,6 @@ http.client
(Contributed by Alexander Enrique Urieles Nieto in :gh:`131724`.)
http.cookies
------------
* Allow '``"``' double quotes in cookie values.
(Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)
http.server
-----------
@ -873,6 +973,12 @@ http.server
<using-on-controlling-color>`.
(Contributed by Hugo van Kemenade in :gh:`146292`.)
* Added :attr:`~http.server.SimpleHTTPRequestHandler.default_content_type`
and the :option:`--content-type <http.server --content-type>` command-line
option to allow customizing the default ``Content-Type`` header
for files with unknown extensions.
(Contributed by John Comeau and Hugo van Kemenade in :gh:`113471`.)
inspect
-------
@ -884,13 +990,13 @@ inspect
json
----
* Add the *array_hook* parameter to :func:`~json.load` and
* Add the *array_hook* parameter to :func:`~json.load` and
:func:`~json.loads` functions:
allow a callback for JSON literal array types to customize Python lists in
the resulting decoded object. Passing combined :class:`frozendict` to
*object_pairs_hook* param and :class:`tuple` to ``array_hook`` will yield a
deeply nested immutable Python structure representing the JSON data.
(Contributed by Joao S. O. Bueno in :gh:`146440`)
(Contributed by Joao S. O. Bueno in :gh:`146440`.)
locale
@ -918,23 +1024,11 @@ math
mimetypes
---------
* Add ``application/dicom`` MIME type for ``.dcm`` extension.
(Contributed by Benedikt Johannes in :gh:`144217`.)
* Add ``application/efi``. (Contributed by Charlie Lin in :gh:`145720`.)
* Add ``application/node`` MIME type for ``.cjs`` extension.
(Contributed by John Franey in :gh:`140937`.)
* Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
* Add ``application/sql`` and ``application/vnd.sqlite3``.
(Contributed by Charlie Lin in :gh:`145698`.)
* Add the following MIME types:
- ``application/vnd.ms-cab-compressed`` for ``.cab`` extension
- ``application/vnd.ms-htmlhelp`` for ``.chm`` extension
- ``application/vnd.ms-officetheme`` for ``.thmx`` extension
(Contributed by Charlie Lin in :gh:`145718`.)
* Add ``image/jxl``. (Contributed by Foolbar in :gh:`144213`.)
* Add more MIME types.
(Contributed by Benedikt Johannes, Charlie Lin, Foolbar, Gil Forcada and
John Franey
in :gh:`144217`, :gh:`145720`, :gh:`140937`, :gh:`139959`, :gh:`145698`,
:gh:`145718` and :gh:`144213`.)
* Rename ``application/x-texinfo`` to ``application/texinfo``.
(Contributed by Charlie Lin in :gh:`140165`.)
* Changed the MIME type for ``.ai`` files to ``application/pdf``.
@ -976,6 +1070,13 @@ os.path
(Contributed by Petr Viktorin for :cve:`2025-4517`.)
pdb
---
* Use the new interactive shell as the default input shell for :mod:`pdb`.
(Contributed by Tian Gao in :gh:`145379`.)
pickle
------
@ -983,6 +1084,29 @@ pickle
(Contributed by Zackery Spytz and Serhiy Storchaka in :gh:`77188`.)
pickletools
-----------
* The output of the :mod:`pickletools` command-line interface is colored by
default. This can be controlled with
:ref:`environment variables <using-on-controlling-color>`.
(Contributed by Hugo van Kemenade in :gh:`149026`.)
pprint
------
* Add an *expand* keyword argument for :func:`pprint.pprint`,
:func:`pprint.pformat`, :func:`pprint.pp`. If true, the output will be
formatted similar to pretty-printed :func:`json.dumps` when
*indent* is supplied.
(Contributed by Stefan Todoran, Semyon Moroz and Hugo van Kemenade in
:gh:`112632`.)
* Add t-string support to :mod:`pprint`.
(Contributed by Loïc Simon and Hugo van Kemenade in :gh:`134551`.)
re
--
@ -1104,7 +1228,7 @@ subprocess
If none of these mechanisms are available, the function falls back to the
traditional busy loop (non-blocking call and short sleeps).
(Contributed by Giampaolo Rodola in :gh:`83069`).
(Contributed by Giampaolo Rodola in :gh:`83069`.)
symtable
@ -1121,6 +1245,19 @@ sys
(Contributed by Klaus Zimmermann in :gh:`137476`.)
sys.monitoring
--------------
* The :ref:`other events <monitoring-event-global>`
(:monitoring-event:`PY_THROW`, :monitoring-event:`PY_UNWIND`,
:monitoring-event:`RAISE`, :monitoring-event:`EXCEPTION_HANDLED`, and
:monitoring-event:`RERAISE`) can now be turned on and disabled on a per code
object basis. Returning :data:`~sys.monitoring.DISABLE` from a callback for
one of these events disables the event for the entire code object (for the
current tool), rather than raising :exc:`ValueError` as in prior versions.
(Contributed by Gabriele N. Tornetta in :gh:`146182`.)
tarfile
-------
@ -1147,6 +1284,16 @@ tarfile
(Contributed by Christoph Walcher in :gh:`57911`.)
threading
---------
* Added :class:`~threading.serialize_iterator`,
:func:`~threading.synchronized_iterator`,
and :func:`~threading.concurrent_tee` to support concurrent access to
generators and iterators.
(Contributed by Raymond Hettinger in :gh:`124397`.)
timeit
------
@ -1161,7 +1308,7 @@ timeit
* Make the target time of :meth:`timeit.Timer.autorange` configurable
and add ``--target-time`` option to the command-line interface.
(Contributed by Alessandro Cucci and Miikka Koskinen in :gh:`140283`.)
(Contributed by Alessandro Cucci and Miikka Koskinen in :gh:`80642`.)
tkinter
@ -1190,6 +1337,15 @@ tkinter
(Contributed by Matthias Kievernagel and Serhiy Storchaka in :gh:`47655`.)
tokenize
--------
* The output of the :mod:`tokenize` :ref:`command-line interface
<tokenize-cli>` is colored by default. This can be controlled with
:ref:`environment variables <using-on-controlling-color>`.
(Contributed by Hugo van Kemenade in :gh:`148991`.)
.. _whatsnew315-tomllib-1-1-0:
tomllib
@ -1206,10 +1362,7 @@ tomllib
Previously an inline table had to be on a single line and couldn't end
with a trailing comma. This is now relaxed so that the following is valid:
.. syntax highlighting needs TOML 1.1.0 support in Pygments,
see https://github.com/pygments/pygments/issues/3026
.. code-block:: text
.. code-block:: toml
tbl = {
key = "a string",
@ -1221,7 +1374,7 @@ tomllib
- Add ``\xHH`` notation to basic strings for codepoints under 255,
and the ``\e`` escape for the escape character:
.. code-block:: text
.. code-block:: toml
null = "null byte: \x00; letter a: \x61"
csi = "\e["
@ -1229,7 +1382,7 @@ tomllib
- Seconds in datetime and time values are now optional.
The following are now valid:
.. code-block:: text
.. code-block:: toml
dt = 2010-02-03 14:15
t = 14:15
@ -1281,6 +1434,18 @@ typing
as it was incorrectly inferred in runtime before.
(Contributed by Nikita Sobolev in :gh:`137191`.)
* :pep:`800`: Add :deco:`typing.disjoint_base`, a new decorator marking a class
as a disjoint base. This is an advanced feature primarily intended to allow
type checkers to faithfully reflect the runtime semantics of types defined
as builtins or in compiled extensions. If a class ``C`` is a disjoint base, then
child classes of that class cannot inherit from other disjoint bases that are
not parent or child classes of ``C``. (Contributed by Jelle Zijlstra in :gh:`148639`.)
* :class:`~typing.TypeVarTuple` now accepts ``bound``, ``covariant``,
``contravariant``, and ``infer_variance`` keyword arguments, matching the
interface of :class:`~typing.TypeVar` and :class:`~typing.ParamSpec`.
``bound`` semantics remain undefined in the specification.
unicodedata
-----------
@ -1404,7 +1569,7 @@ Optimizations
=============
* ``mimalloc`` is now used as the default allocator for
for raw memory allocations such as via :c:func:`PyMem_RawMalloc`
raw memory allocations such as via :c:func:`PyMem_RawMalloc`
for better performance on :term:`free-threaded builds <free-threaded build>`.
(Contributed by Kumar Aditya in :gh:`144914`.)
@ -1423,7 +1588,7 @@ base64 & binascii
* Implementation for Base32 has been rewritten in C.
Encoding and decoding is now two orders of magnitude faster.
(Contributed by James Seo in :gh:`146192`)
(Contributed by James Seo in :gh:`146192`.)
csv
@ -1440,11 +1605,11 @@ Upgraded JIT compiler
Results from the `pyperformance <https://github.com/python/pyperformance>`__
benchmark suite report
`6-7% <https://www.doesjitgobrrr.com/run/2026-04-01>`__
`8-9% <https://www.doesjitgobrrr.com/run/2026-04-29>`__
geometric mean performance improvement for the JIT over the standard CPython
interpreter built with all optimizations enabled on x86-64 Linux. On AArch64
macOS, the JIT has a
`12-13% <https://www.doesjitgobrrr.com/run/2026-04-01>`__
`12-13% <https://www.doesjitgobrrr.com/run/2026-04-29>`__
speedup over the :ref:`tail calling interpreter <whatsnew314-tail-call-interpreter>`
with all optimizations enabled. The speedups for JIT
builds versus no JIT builds range from roughly 15% slowdown to over
@ -1517,7 +1682,7 @@ The JIT compiler's machine code generator now produces better machine code
for x86-64 and AArch64 macOS and Linux targets. In general, users should
experience lower memory usage for generated machine code and more efficient
machine code versus 3.14.
(Contributed by Brandt Bucher in :gh:`136528` and :gh:`136528`.
(Contributed by Brandt Bucher in :gh:`136528` and :gh:`135905`.
Implementation for AArch64 contributed by Mark Shannon in :gh:`139855`.
Additional optimizations for AArch64 contributed by Mark Shannon and
Diego Russo in :gh:`140683` and :gh:`142305`.)
@ -1532,6 +1697,16 @@ This was made possible by a refactoring of JIT data structures.
Removed
========
ast
---
* The constructors of :ref:`AST nodes <ast_nodes>` now raise a :exc:`TypeError`
when a required argument is omitted or when a keyword argument that does not
map to a field on the AST node is passed. These cases had previously raised a
:exc:`DeprecationWarning` since Python 3.13.
(Contributed by Brian Schubert and Jelle Zijlstra in :gh:`137600` and :gh:`105858`.)
collections.abc
---------------
@ -1540,15 +1715,6 @@ collections.abc
deprecated since Python 3.12, and is scheduled for removal in Python 3.17.
datetime
--------
* :meth:`~datetime.datetime.strptime` now raises :exc:`ValueError` when the
format string contains ``%d`` (day of month) without a year directive.
This has been deprecated since Python 3.13.
(Contributed by Stan Ulbrych and Gregory P. Smith in :gh:`70647`.)
ctypes
------
@ -1563,6 +1729,15 @@ ctypes
(Contributed by Victor Stinner in :gh:`148675`.)
datetime
--------
* :meth:`~datetime.datetime.strptime` now raises :exc:`ValueError` when the
format string contains ``%d`` (day of month) without a year directive.
This has been deprecated since Python 3.13.
(Contributed by Stan Ulbrych and Gregory P. Smith in :gh:`70647`.)
glob
----
@ -1605,20 +1780,6 @@ platform
(Contributed by Alexey Makridenko in :gh:`133604`.)
pprint
------
* Add an *expand* keyword argument for :func:`pprint.pprint`,
:func:`pprint.pformat`, :func:`pprint.pp`. If true, the output will be
formatted similar to pretty-printed :func:`json.dumps` when
*indent* is supplied.
(Contributed by Stefan Todoran, Semyon Moroz and Hugo van Kemenade in
:gh:`112632`.)
* Add t-string support to :mod:`pprint`.
(Contributed by Loïc Simon and Hugo van Kemenade in :gh:`134551`.)
sre_*
-----
@ -1642,6 +1803,14 @@ threading
(Contributed by Bénédikt Tran in :gh:`134087`.)
types
-----
* Removed deprecated in :pep:`626` since Python 3.12
:attr:`!codeobject.co_lnotab` from :class:`types.CodeType`.
(Contributed by Nikita Sobolev in :gh:`134690`.)
typing
------
@ -1661,6 +1830,9 @@ typing
or ``TD = TypedDict("TD", {})`` instead.
(Contributed by Bénédikt Tran in :gh:`133823`.)
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
(Contributed by Nikita Sobolev in :gh:`133601`.)
wave
----
@ -1776,8 +1948,6 @@ New deprecations
:func:`issubclass`, but warnings were not previously emitted if it was
merely imported or accessed from the :mod:`!typing` module.
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
(Contributed by Nikita Sobolev in :gh:`133601`.)
* ``__version__``
@ -2064,8 +2234,8 @@ Deprecated C APIs
- :c:macro:`Py_ALIGNED`: Prefer ``alignas`` instead.
- :c:macro:`PY_FORMAT_SIZE_T`: Use ``"z"`` directly.
- :c:macro:`Py_LL` & :c:macro:`Py_ULL`:
Use standard suffixes, ``LL`` & ``ULL``.
- :c:macro:`Py_LL` and :c:macro:`Py_ULL`:
Use standard suffixes, ``LL`` and ``ULL``.
- :c:macro:`PY_LONG_LONG`, :c:macro:`PY_LLONG_MIN`, :c:macro:`PY_LLONG_MAX`,
:c:macro:`PY_ULLONG_MAX`, :c:macro:`PY_INT32_T`, :c:macro:`PY_UINT32_T`,
:c:macro:`PY_INT64_T`, :c:macro:`PY_UINT64_T`, :c:macro:`PY_SIZE_MAX`:
@ -2114,6 +2284,16 @@ Build changes
and :option:`-X dev <-X>` is passed to the Python or Python is built in :ref:`debug mode <debug-build>`.
(Contributed by Donghee Na in :gh:`141770`.)
.. _whatsnew315-frame-pointers:
* CPython is now built with frame pointers enabled by default
(:pep:`831`). Pass :option:`--without-frame-pointers` to opt out.
Authors of C extensions and native libraries built with custom build
systems should add ``-fno-omit-frame-pointer`` and
``-mno-omit-leaf-frame-pointer`` to their own ``CFLAGS`` to keep the
unwind chain intact.
(Contributed by Pablo Galindo Salgado and Savannah Ostrowski in :gh:`149201`.)
.. _whatsnew315-windows-tail-calling-interpreter:
* 64-bit builds using Visual Studio 2026 (MSVC 18) may now use the new

View file

@ -2173,7 +2173,7 @@ Changes in the Python API
* :c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg**
argument is not set. Previously only ``NULL`` was returned.
* The format of the :attr:`~codeobject.co_lnotab` attribute of code objects
* The format of the :attr:`!codeobject.co_lnotab` attribute of code objects
changed to support
a negative line number delta. By default, Python does not emit bytecode with
a negative line number delta. Functions using :attr:`frame.f_lineno`,

View file

@ -554,10 +554,12 @@ complex_number[expr_ty]:
signed_number[expr_ty]:
| NUMBER
| '+' number=NUMBER { number }
| '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }
signed_real_number[expr_ty]:
| real_number
| '+' real=real_number { real }
| '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }
real_number[expr_ty]:
@ -565,6 +567,7 @@ real_number[expr_ty]:
imaginary_number[expr_ty]:
| imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }
| '+' imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }
capture_pattern[pattern_ty]:
| target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name.id, EXTRA) }

View file

@ -9,10 +9,11 @@
// is not needed.
// Include Python header files
#include "patchlevel.h"
#include "pyconfig.h"
#include "pymacconfig.h"
// Include Python configuration headers
#include "patchlevel.h" // the Python version
#include "pyconfig.h" // information from configure
#include "pymacconfig.h" // overrides for pyconfig
#include "pyabi.h" // feature/ABI selection
// Include standard header files
@ -46,13 +47,11 @@
# endif
#endif
#if defined(Py_GIL_DISABLED)
# if defined(_MSC_VER)
# include <intrin.h> // __readgsqword()
# endif
# if defined(__MINGW32__)
# include <intrin.h> // __readgsqword()
#if !defined(Py_LIMITED_API)
# if defined(Py_GIL_DISABLED)
# if defined(_MSC_VER) || defined(__MINGW32__)
# include <intrin.h> // __readgsqword()
# endif
# endif
#endif // Py_GIL_DISABLED
@ -67,6 +66,7 @@ __pragma(warning(disable: 4201))
// Include Python header files
#include "pyport.h"
#include "exports.h"
#include "pymacro.h"
#include "pymath.h"
#include "pymem.h"
@ -117,6 +117,7 @@ __pragma(warning(disable: 4201))
#include "cpython/genobject.h"
#include "descrobject.h"
#include "genericaliasobject.h"
#include "cpython/sentinelobject.h"
#include "warnings.h"
#include "weakrefobject.h"
#include "structseq.h"

View file

@ -38,7 +38,7 @@ typedef struct {
PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void);
PyAPI_FUNC(int) PyUnstable_WritePerfMapEntry(
const void *code_addr,
unsigned int code_size,
size_t code_size,
const char *entry_name);
PyAPI_FUNC(void) PyUnstable_PerfMapState_Fini(void);
PyAPI_FUNC(int) PyUnstable_CopyPerfMapFile(const char* parent_filename);

View file

@ -24,9 +24,10 @@ extern "C" {
#define PY_MONITORING_EVENT_STOP_ITERATION 10
#define PY_MONITORING_IS_INSTRUMENTED_EVENT(ev) \
((ev) < _PY_MONITORING_LOCAL_EVENTS)
((ev) <= PY_MONITORING_EVENT_STOP_ITERATION)
/* Other events, mainly exceptions */
/* Other events, mainly exceptions.
* These can now be turned on and disabled on a per code object basis. */
#define PY_MONITORING_EVENT_RAISE 11
#define PY_MONITORING_EVENT_EXCEPTION_HANDLED 12
@ -34,6 +35,9 @@ extern "C" {
#define PY_MONITORING_EVENT_PY_THROW 14
#define PY_MONITORING_EVENT_RERAISE 15
#define _PY_MONITORING_IS_UNGROUPED_EVENT(ev) \
((ev) < _PY_MONITORING_UNGROUPED_EVENTS)
/* Ancillary events */

View file

@ -144,6 +144,7 @@ typedef struct _optimization_stats {
uint64_t unknown_callee;
uint64_t trace_immediately_deopts;
uint64_t executors_invalidated;
uint64_t fitness_terminated_traces;
UOpStats opcode[PYSTATS_MAX_UOP_ID + 1];
uint64_t unsupported_opcode[256];
uint64_t trace_length_hist[_Py_UOP_HIST_SIZE];

View file

@ -0,0 +1,22 @@
/* Sentinel object interface */
#ifndef Py_LIMITED_API
#ifndef Py_SENTINELOBJECT_H
#define Py_SENTINELOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
PyAPI_DATA(PyTypeObject) PySentinel_Type;
#define PySentinel_Check(op) Py_IS_TYPE((op), &PySentinel_Type)
PyAPI_FUNC(PyObject *) PySentinel_New(
const char *name,
const char *module_name);
#ifdef __cplusplus
}
#endif
#endif /* !Py_SENTINELOBJECT_H */
#endif /* !Py_LIMITED_API */

View file

@ -36,7 +36,7 @@
#define Py_LOCAL_SYMBOL
#endif
/* module init functions outside the core must be exported */
#if defined(Py_BUILD_CORE)
#if defined(_PyEXPORTS_CORE)
#define _PyINIT_EXPORTED_SYMBOL Py_EXPORTED_SYMBOL
#else
#define _PyINIT_EXPORTED_SYMBOL __declspec(dllexport)
@ -64,13 +64,13 @@
/* only get special linkage if built as shared or platform is Cygwin */
#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)
# if defined(HAVE_DECLSPEC_DLL)
# if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# if defined(_PyEXPORTS_CORE) && !defined(_PyEXPORTS_CORE_MODULE)
/* module init functions inside the core need no external linkage */
/* except for Cygwin to handle embedding */
# if !defined(__CYGWIN__)
# define _PyINIT_FUNC_DECLSPEC
# endif /* __CYGWIN__ */
# else /* Py_BUILD_CORE */
# else /* _PyEXPORTS_CORE */
/* Building an extension module, or an embedded situation */
/* public Python functions and data are imported */
/* Under Cygwin, auto-import functions to prevent compilation */
@ -80,7 +80,7 @@
# define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE
# endif /* !__CYGWIN__ */
# define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE
# endif /* Py_BUILD_CORE */
# endif /* _PyEXPORTS_CORE */
# endif /* HAVE_DECLSPEC_DLL */
#endif /* Py_ENABLE_SHARED */

Some files were not shown because too many files have changed in this diff Show more