1050 Commits
Author SHA1 Message Date
Ned BatchelderandGitHub 8b2dd805a7 [3.13] Docs: split builtins to their own page from library (GH-156682) (#157440)
* [3.13] Docs: split builtins to their own page from library (GH-156682)

* Docs: split builtins to their own page from library

* review feedback

* addressed Hugo's feedback

* update the What's Next page

* one more wording tweak

* move builtins to their own directory. fix the reference name

* moved pages need to be noted in tools/removed-ids.txt

* add Python to the builtins reference title

* add sphinxext-rediraffe for the library->builtins split

* update check-html-ids to handle rediraffe redirects

* now we don't need (page missing) for the redirected pages

* update other references to moved pages

* A seealso from builtins to library

* make a nice section for rediraffe settings

* move the builtins note to the end, as a seealso

* address merwok's comments

* cache looking for ids in files

* simplify the intro paragraphs
(cherry picked from commit 59c4bddb17)

Co-authored-by: Ned Batchelder <[email protected]>

* remove references to non-existent pages
2026-09-13 13:02:07 -04:00
2932294c22 [3.13] gh-156837: Refer to yield expressions in generator function definitions (GH-156863) (GH-157219)
(cherry picked from commit 2723799c7f)

Co-authored-by: Lucas <[email protected]>
2026-09-09 17:57:36 +02:00
9f395f7fee [3.13] gh-156614: Fix the parameter list grammar in the language reference (GH-156622) (#156671)
(cherry picked from commit 852381efee)

Co-authored-by: Aradhya Gupta <[email protected]>
2026-08-30 17:15:44 +00:00
1e577e1842 [3.13] gh-105812: Make use of the Sphinx deco role in documentation (GH-139598) (#154983)
Co-authored-by: Victorien <[email protected]>
2026-07-31 09:31:44 +00:00
b4c1adad96 [3.13] Fix minor typos in 'Compound statements' docs (GH-149666) (#153115)
(cherry picked from commit 856049a9d9)

Co-authored-by: Jonathan Dung <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
2026-07-05 11:29:37 +00:00
7c5734c791 [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814)
gh-150319: Replace all documentation which says "See PEP 585" (#150325)

* Replace all documentation which says "See PEP 585"

The following classes in the stdlib get simple updates:

- array.array
- asyncio.Future
- asyncio.Task
- collections.defaultdict
- collections.deque
- contextvars.ContextVar
- contextvars.Token
- ctypes.Array
- os.DirEntry
- re.Match
- re.Pattern
- string.templatelib.Interpolation
- string.templatelib.Template
- types.MappingProxyType
- queue.SimpleQueue
- weakref.ref

The following classes are documented publicly as functions, and are
therefore updated internally (`__class_getitem__.__doc__`) but not in the
public docs:

- functools.partial
- itertools.chain

The following builtin types have updates to `__class_getitem__.__doc__`
but not to any documentation pages:

- BaseExceptionGroup
- coroutines (from generators)
- dict
- enumerate
- frozendict
- frozenset
- generators (and async generators)
- list
- memoryview
- set
- slice
- tuple

Special cases:

- union objects are now documented as "supporting class-level []",
  rather than anything to do with generics.

- Templates might be generic over a single type (union, in theory) or
  over a TypeVarTuple. As this is not currently fully settled, it is
  marked with a comment and a mild hint that it is a single type is used
  (namely, "type" is singular rather than "types", plural)

* Apply suggestions from code review



* Correct several class getitem docs

And expand the text for tuples.



* Add notes on generic typing of builtins

* Fix typo in tuple.__class_getitem__ docstring

* Typo fix: malformed refs

Fix `generic` links which weren't marked as `:ref:`.

* Strike unnecessary docs on generic-ness



* Apply suggestions from code review

These are applied at both the originally indicated locations and in the
corresponding docstring definitions.



* Update Doc/library/re.rst



* Update Objects/enumobject.c



* Remove tuple generic doc in 'stdtypes' page

This is covered in more detail in the cross-linked typing documentation.
The other copy of this documentation -- in the docstring for
`tuple.__class_getitem__` -- is left in place.

* Fix whitespace around new doc of generics

Per review, do not introduce or remove whitespace such that section
breaks are altered by the introduction of doc on various generic types.

In most cases, this is a removal of an extra line.

In one case (Arrays), it is the reintroduction of a line.

Additionally, two other minor fixes are included:
- incorrect indent on 'defaultdicts'
- make `mappingproxy.__class_getitem__.__doc__` consistent with other
  mapping type generic docs



* Move placement of memoryview generic note

Previous placement was at the end of the main docstring, which is
consistent with other types but places it after a section on various
methods (which makes it read somewhat inconsistently). Moving it up
helps resolve.



* Ensure sphinxdoc does not start sentences lowercase

Lowercase class names at the start of sentences are marked out with the
`class` role. In the case of `deque`, documentation already refers to
these as `Deques`, so this form is preferred.

* Apply suggestions from code review



* Fix line endings and wrap more tightly

Line endings fixed by pre-commit ; also re-wrapped the MappingProxyType
text which was too long.

* Use 'ContextVars' style in sphinx doc

---------

Co-authored-by: Stephen Rosen <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>
2026-06-02 22:26:33 +00:00
92a1c8bf14 [3.13] gh-148672: Document namespace subpackages inside regular packages (GH-150056) (#150731)
gh-148672: Document namespace subpackages inside regular packages (GH-150056)
(cherry picked from commit 9ba2a89179)

Co-authored-by: Taeknology <[email protected]>
2026-06-01 19:29:31 +00:00
446c91e5fb [3.13] gh-149861: Fix rule in match statement case_block PEG grammar (#150512)
(cherry picked from commit 99c254e2f7)

Co-authored-by: Ivy Xu <[email protected]>
2026-05-27 16:25:43 +01:00
4da3e91363 [3.13] Link to existing rules in compound_stmts.rst (GH-149811) (GH-149838)
Link to existing rules in compound_stmts.rst (GH-149811)

In gh-138418, `!` was added to links to rules that don't exist in
the docs, in order to silence broken link warnings.
However, productionlist doesn't parse the `!`, which ends up in
the rendered documentation. (It's possible that gh-127835 broke
the `!` support.)

Replace the names with ones that appear in docs:

- `star_named_expression` in the grammar corresponds to
  `flexible_expression` in the docs
- `star_named_expressions` in the grammar corresponds to
  `flexible_expression_list` in the docs
- `named_expression` in the grammar corresponds to
  `assignment_expression` in the docs

Having two sets of names isn't great of course. Consolidating them
is tracked in (subissues of) gh-127833.
(cherry picked from commit c37529293d)

Co-authored-by: Petr Viktorin <[email protected]>
2026-05-14 19:34:29 +02:00
3868444600 [3.13] gh-137337: Clarify import statement namespace binding (GH-144607) (GH-149370)
It is not always in the local namespace.
(cherry picked from commit b8ebd078f9)

Co-authored-by: Kit Dallege <[email protected]>
2026-05-04 14:52:02 +00:00
c38c463c14 [3.13] gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945) (#139510)
* gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945)

The section provides a brief overview of the Python runtime's execution environment.  It is meant to be implementation agnostic,
(cherry picked from commit 46a1f0a9ff)

Co-authored-by: Eric Snow <[email protected]>

* concurrent.interpreters was added to Python 3.14

---------

Co-authored-by: Eric Snow <[email protected]>
Co-authored-by: T. Wouters <[email protected]>
Co-authored-by: Kumar Aditya <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
2026-04-30 10:42:34 +00:00
f17ed5e9bf [3.13] gh-74955: Document that __all__ must contain strings in normalization form NFKC (GH-144504) (GH-144520)
(cherry picked from commit c81e1843d4)

Co-authored-by: Serhiy Storchaka <[email protected]>
2026-03-24 02:01:06 +00:00
dbe2500e0e [3.13] gh-145305: Update ocert.org URLs in docs from http to https (GH-145304) (GH-145323)
(cherry picked from commit 11eec7a492)

Co-authored-by: indoor47 <[email protected]>
Co-authored-by: Adam (indoor47) <[email protected]>
2026-03-24 02:51:43 +01:00
eec26ea925 [3.13] gh-101100: Fix sphinx reference warnings around I/O (GH-139592) (#145795)
Co-authored-by: Cody Maloney <[email protected]>
Co-authored-by: Carol Willing <[email protected]>
2026-03-11 08:08:51 +00:00
cbecfbe792 [3.13] gh-144386: Update equivalent code for "with", "async with" and "async for" (GH-144472) (GH-144946)
They use special method lookup for special methods.
(cherry picked from commit 9e8fa2d4d1)

Co-authored-by: Serhiy Storchaka <[email protected]>
2026-02-18 11:22:24 +00:00
e1dbe2263a [3.13] gh-101100: Resolve reference warnings in reference/ (GH-138418) (#138681)
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
2026-02-15 03:06:50 +00:00
f9f0a78f1c [3.13] gh-101888: Add function.__builtins__ to ref documentation (GH-144174) (#144253)
gh-101888: Add function.__builtins__ to ref documentation (GH-144174)
(cherry picked from commit 933540e332)

Co-authored-by: Victor Stinner <[email protected]>
2026-01-26 16:22:31 +00:00
7fc3aa5575 [3.13] gh-69686: Remove untrue part of __import__ replacement docs (GH-143261) (#143282)
gh-69686: Remove untrue part of `__import__` replacement docs (GH-143261)

Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in python/cpython#69686.
(cherry picked from commit 79c03ac001)

Co-authored-by: Thanos <[email protected]>
2025-12-30 05:22:47 +00:00
450f863ea6 [3.13] Add missing comma to tuple in except* docs (GH-142395) (#142684)
Co-authored-by: dr-carlos <[email protected]>
2025-12-13 22:57:22 +00:00
8d920ac1a5 [3.13] GH-138562: Remove `sort()` from the common sequence methods in the data model (GH-138563) (#140676)
(cherry picked from commit d0c9943869)

Co-authored-by: Adam Turner <[email protected]>
2025-12-01 23:29:13 +01:00
5d7cacb1db [3.13] GH-101100: Remove some entries from `nitpick_ignore` (GH-138464) (#141827)
(cherry picked from commit 22cb9ba8f9)

Co-authored-by: Adam Turner <[email protected]>
2025-12-01 23:26:32 +01:00
db0900be6e [3.13] Docs: replace an esoteric Von Neumann mention (GH-137598) (#140371)
Co-authored-by: Ned Batchelder <[email protected]>
2025-11-05 23:40:56 +02:00
677a488e04 [3.13] gh-66646: Explain __base__ attribute in the docs (GH-102554) (GH-140366)
(cherry picked from commit faa169afa0)

Co-authored-by: Furkan Onder <[email protected]>
Co-authored-by: Éric <[email protected]>
2025-10-21 09:06:56 +02:00
63ba8018a1 [3.13] gh-97914: Reword misleading sentence on conditional expressions (GH-139064) (#140094)
Co-authored-by: Irit Katriel <[email protected]>
Co-authored-by: Gilles Peiffer <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
2025-10-14 08:29:16 +00:00
Adam TurnerandGitHub ac853ece08 [3.13] gh-105812: Use the `:deco:` role in place of manual decorator markup (GH-139619) (#139628) 2025-10-05 20:28:30 +00:00
Miss Islington (bot)andGitHub eadcf4dcaf [3.13] Make sure the `:keyword: role works for case` (GH-138878) (#139201) 2025-09-21 10:58:06 +00:00
2d24b13d03 [3.13] gh-137376: Add note on top-level global declarations (GH-137707) (#138022)
(cherry picked from commit 9f05f98730)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Brian Schubert <[email protected]>
2025-09-18 13:02:17 +01:00
54d5235ed3 [3.13] gh-138871: Clarify NameError exception in 'del' (GH-138881) (#138904)
(cherry picked from commit 481588ad4c)

Co-authored-by: Kian Eliasi <[email protected]>
2025-09-18 12:43:24 +01:00
f91884e820 [3.13] gh-135629: rewrite language reference section on except* to improve clarity (GH-136150) (#139060)
gh-135629: rewrite language reference section on except* to improve clarity (GH-136150)
(cherry picked from commit a651ec9524)

Co-authored-by: Irit Katriel <[email protected]>
2025-09-17 16:00:53 +00:00
e7bb98a173 [3.13] GH-138465: Improve documentation for common sequence methods (GH-138474) (#138567)
Co-authored-by: Serhiy Storchaka <[email protected]>
2025-09-05 21:39:32 +00:00
4ee0ef9b59 [3.13] GH-101100: Resolve reference warnings in whatsnew/3.6.rst (GH-138411) (#138456)
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
2025-09-03 15:28:22 +00:00
154ec76def [3.13] GH-101100: Resolve reference warnings in whatsnew/3.7.rst (GH-138410) (#138424)
GH-101100: Resolve reference warnings in whatsnew/3.7.rst (GH-138410)

Resolve reference warnings in whatsnew/3.7.rst
(cherry picked from commit dd86fb4ba5)

Co-authored-by: Adam Turner <[email protected]>
2025-09-03 06:27:17 +00:00
f88bf2ce0d [3.13] gh-138297 Point link in docs for finally to try/else, instead of if/else (GH-138298) (#138382)
Co-authored-by: James Parrott <[email protected]>
Co-authored-by: Brian Schubert <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
2025-09-02 15:10:30 +00:00
b772427902 [3.13] Docs: Small clarity change for `except*` (GH-121073) (#137495)
Co-authored-by: Greg Stein <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
2025-08-06 22:04:15 +00:00
a7246323a2 [3.13] gh-135110: Fix misleading generator.close() documentation (GH-135152) (GH-135986)
gh-135110: Fix misleading `generator.close()` documentation (GH-135152)

The documentation incorrectly stated that generator.close() 'raises' a
GeneratorExit exception. This was misleading because the method doesn't
raise the exception to the caller - it sends the exception internally
to the generator and returns None.
(cherry picked from commit 0d76dccc3b)

Co-authored-by: Connor Denihan <[email protected]>
2025-06-26 13:34:11 +00:00
86c050a5ca [3.13] Docs: Add cross-reference for positional_item in the calls productionlist (GH-129977) (GH-135941)
Docs: Add cross-reference for `positional_item` in the `calls` productionlist (GH-129977)

Add missing hyperlink for `positional_item`
(cherry picked from commit d2154912b3)

Co-authored-by: HarryLHW <[email protected]>
2025-06-25 14:31:25 +00:00
a80d47ecb1 [3.13] gh-135171: Update documentation for the generator expression (GH-135351) (GH-135525)
gh-135171: Update documentation for the generator expression (GH-135351)

* gh-135171: Update documentation for the generator expression

Document that the iterator for the leftmost "for" clause is created
immediately.

* Update Doc/reference/expressions.rst



---------
(cherry picked from commit 8979d3afe3)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Brian Skinn <[email protected]>
2025-06-15 00:38:52 +00:00
a063d6c794 [3.13] gh-127833: lexical analysis: Add backticks to BOM example (GH-132407) (#133633)
gh-127833: lexical analysis: Add backticks to BOM example (GH-132407)
(cherry picked from commit 0552ce0fb2)

Co-authored-by: Stan Ulbrych <[email protected]>
2025-05-08 01:42:05 +00:00
2c9842f7ac [3.13] doc: update co_flags reference (GH-132300) (#132936)
Co-authored-by: Inada Naoki <[email protected]>
2025-04-26 21:47:51 +03:00
eedaa4eefb [3.13] gh-131457: Fix typo in BNF description of function signatures (GH-131460) (#131575)
gh-131457: Fix typo in BNF description of function signatures (GH-131460)
(cherry picked from commit 8b7d20d3a9)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <[email protected]>
2025-03-22 08:00:54 +00:00
25ae2045a8 [3.13] gh-116666: Add "token" glossary term (GH-130888) (GH-131367)
gh-116666: Add "token" glossary term (GH-130888)

Add glossary entry for `token`, and link to it.
Avoid talking about tokens in the SyntaxError intro (errors.rst); at this point
tokenization is too much of a technical detail. (Even to an advanced reader,
the fact that a *single* token is highlighted isn't too relevant. Also, we don't
need to guarantee that it's a single token.)
(cherry picked from commit 30d5205849)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
2025-03-18 12:51:02 +01:00
c68a8722be [3.13] gh-121970: Replace .. coroutine{method,function} with :async: (GH-130448) (#130465)
(cherry picked from commit 5ec4bf86b7)

Co-authored-by: sobolevn <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
2025-02-22 18:00:49 +00:00
Miss Islington (bot)andGitHub 692d36f1fc Doc: update term "namespace package" (GH-129251)
(cherry picked from commit e65e9f9062)
2025-02-15 15:10:24 +09:00
508ace6705 [3.13] gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (GH-122847) (#129150)
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (GH-122847)

Thanks to Artur Chakhvadze for bugfix.
(cherry picked from commit 6105846390)

Co-authored-by: Sergey B Kirpichev <[email protected]>
2025-01-21 20:12:43 +00:00
32adae1a10 [3.13] gh-126664: revert: Use else instead of finally in docs explaining "with" (GH-128169) (#128170)
gh-126664: revert: Use `else` instead of `finally` in docs explaining "with" (GH-128169)

Revert "gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)"

This reverts commit 25257d61cf.
(cherry picked from commit 228f275737)

Co-authored-by: Gregory P. Smith <[email protected]>
2024-12-24 10:55:57 -08:00
2d458b16e6 [3.13] gh-126720: Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720) (#126885)
Docs: Miscellaneous corrections to simple statements in the language reference (GH-126720)

* Replace: The :keyword:`global` -> The :keyword:`global` statement
Add :keyword: when it's needed

* Replace repeated links with duoble backticks

(cherry picked from commit 94a7a4e22f)

Co-authored-by: Beomsoo Kim <[email protected]>
2024-12-02 15:10:59 +01:00
4fd628837c [3.13] Document that return-less user-defined functions return None (GH-126769) (#126822)
Document that return-less user-defined functions return None (GH-126769)
(cherry picked from commit e0692f1165)

Co-authored-by: John Marshall <[email protected]>
Co-authored-by: Andrew Svetlov <[email protected]>
Co-authored-by: Carol Willing <[email protected]>
2024-11-14 10:46:58 +01:00
47748758e7 [3.13] gh-126664: Use else instead of finally in "The with statement" documentation. (GH-126665) (#126670)
gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)
(cherry picked from commit 25257d61cf)

Co-authored-by: vivodi <[email protected]>
2024-11-11 06:54:26 +00:00
fa3ee75e6a [3.13] Postpone module.__loader__ deprecation to Python 3.16 (GH-126482) (#126638)
Postpone `module.__loader__` deprecation to Python 3.16 (#126482)

(cherry picked from commit 450db61a78)

Co-authored-by: Hugo van Kemenade <[email protected]>
2024-11-10 01:01:05 +00:00
Hugo van KemenadeandGitHub cccc066241 [3.13] gh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (GH-126392) (#126403)
(cherry picked from commit eac41c5ddf)
2024-11-04 19:46:26 +02:00