Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
de93be5
Fix problem with symlink paths in unittest/loader.py
neek78 Apr 23, 2026
665b7df
Improve `hash()` builtin docstring with caveats. (GH-125229)
gpshead Apr 24, 2026
95559d2
gh-108951: add TaskGroup.cancel() (#127214)
belm0 Apr 24, 2026
db0ee44
gh-142186: Revert the unintended value change in the `PY_MONITORING_E…
scoder Apr 25, 2026
c650b51
gh-148973: fix segfault on mismatch between consts size and oparg in …
iritkatriel Apr 25, 2026
9dab866
gh-148588: Document `__lazy_modules__` (#148590)
johnslavik Apr 25, 2026
5ea3ae7
gh-140287: Handle `PYTHONSTARTUP` script exceptions in the asyncio RE…
johnslavik Apr 25, 2026
6d7bbee
gh-148947: dataclasses: fix error on empty __class__ cell (#148948)
JelleZijlstra Apr 25, 2026
85d3bcd
gh-134690: Removed deprecated `codetype.co_lnotab` (#134691)
sobolevn Apr 25, 2026
a2fa63b
gh-140727: Update tachyon logo (#148965)
maigimenez Apr 25, 2026
b2f126c
gh-148989: `_remote_debugging`: Remove dead code, unnecessary gc stat…
maurycy Apr 25, 2026
c5fcdb4
gh-146311: Reject non-canonical padding bits in base32, 64, & 85 deco…
gpshead Apr 25, 2026
e1384cf
gh-141473: Speed up subprocess test_communicate_timeout_large_input l…
gpshead Apr 26, 2026
0a39730
gh-137855: Lazy import `inspect` module in dataclasses (#144387)
danielhollas Apr 26, 2026
6d4ca16
gh-148981: Add color parameter to `ast.dump` (#148982)
StanFromIreland Apr 26, 2026
5d41632
gh-146455: Fix O(N²) in add_const() after constant folding moved to C…
zSirius Apr 26, 2026
1e7dfbc
gh-148991: Add colour to `tokenize` CLI output (#148992)
hugovk Apr 26, 2026
2754e9a
gh-47798: Refactor the POSIX subprocess.Popen._communicate selector l…
gpshead Apr 27, 2026
f27e91e
Document that multiprocessing treats local same-user processes as tru…
gpshead Apr 27, 2026
804c213
gh-82665 Mention that HTMLParser.handle_starttag value can be None (#…
Fearless-Badger Apr 27, 2026
54a8921
Fix typo in `ceval.c` error message (#148860)
Anonymous941 Apr 27, 2026
62792c8
gh-148868: Increase test coverage for `cmath.isinf` (#148869)
manoj-km24 Apr 27, 2026
f4a726d
GH-135357: Add socket.SO_PASSRIGHTS constant (#135355)
ltworf Apr 27, 2026
a386a52
Un-skip previously-broken `test_get_type_hints_modules_forwardref` (#…
KowalskiThomas Apr 27, 2026
276f474
GH-146073: Add fitness to executor dumps. (GH-148959)
markshannon Apr 27, 2026
3e5a3cb
gh-148529: Minor improvements of the struct module documentation (GH-…
serhiy-storchaka Apr 27, 2026
fc829e8
gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files…
serhiy-storchaka Apr 27, 2026
005555a
gh-149017: Upgrade bundled Expat to 2.8.0 (#149020)
StanFromIreland Apr 27, 2026
0efd679
gh-148252: Avoid overflow in `_remote_debugging` binary reader bounds…
maurycy Apr 27, 2026
29a92ab
gh-148829: Implement PEP 661 (#148831)
JelleZijlstra Apr 28, 2026
d2f506a
gh-137600: Promote `ast` node constructor deprecation warnings to err…
brianschubert Apr 28, 2026
c8799f1
gh-149035: Modernize legacy Python patterns in `Doc/tutorial/stdlib2.…
ByteFlowing1337 Apr 28, 2026
2925139
gh-125862: Keep ContextDecorator open across generator/coroutine exec…
agronholm Apr 28, 2026
9a57179
GH-83065: Fix import deadlock by implementing hierarchical module loc…
gpshead Apr 28, 2026
f8cadda
Merge remote-tracking branch 'upstream/main' into fixes5
neek78 Apr 28, 2026
be968c7
gh-148571: [JIT] Preserve family-head recorder layouts for specialize…
cocolato Apr 28, 2026
2b6a137
gh-148211: decompose `_SHUFFLE_3_LOAD_CONST_INLINE_BORROW` in JIT (GH…
NekoAsakura Apr 28, 2026
993e204
gh-142927: Fix inverted flamegraph width (#148568)
ivonastojanovic Apr 28, 2026
8a8d737
gh-108951: document addition of TaskGroup.cancel() (#149031)
belm0 Apr 28, 2026
933e2dd
Replace deprecated action with RtD app (#149111)
hugovk Apr 28, 2026
40dc61a
Build docs from `pylock.toml` (#149058)
hugovk Apr 28, 2026
37cbbf2
Merge remote-tracking branch 'upstream/main' into fixes5
neek78 Apr 28, 2026
2674c32
gh-149119: docs: mention that sentinel does not support subclassing (…
StelarDream Apr 28, 2026
d71e3bc
gh-148829: bump number of static types (#149121)
JelleZijlstra Apr 29, 2026
341fa84
Merge remote-tracking branch 'upstream/main' into fixes5
neek78 Apr 29, 2026
d4eee16
gh-142927: Show module names instead of file paths in flamegraph (#14…
ivonastojanovic Apr 29, 2026
4930555
Merge remote-tracking branch 'upstream/main' into fixes5
neek78 Apr 29, 2026
c3350d2
add blurb
neek78 Apr 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .github/workflows/documentation-links.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Doc/c-api/concrete.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Other Objects
picklebuffer.rst
weakref.rst
capsule.rst
sentinel.rst
frame.rst
gen.rst
coro.rst
Expand Down
35 changes: 35 additions & 0 deletions Doc/c-api/sentinel.rst
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
18 changes: 15 additions & 3 deletions Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The abstract grammar is currently defined as follows:
:language: asdl


.. _ast_nodes:

Node classes
------------

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -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)
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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:

Expand Down
78 changes: 30 additions & 48 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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.

Expand Down Expand Up @@ -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
========

Expand Down
Loading
Loading