Commit graph

979 commits

Author SHA1 Message Date
Miss Islington (bot)
c6f3f83d88
[3.12] gh-115528: Update language reference for PEP 646 (GH-121181) (#124633)
gh-115528: Update language reference for PEP 646 (GH-121181)

To recap: the objective is to make starred expressions valid in `subscription`,
which is used for generics: `Generic[...]`, `list[...]`, etc.

What _is_ gramatically valid in such contexts? Seemingly any of the following.
(At least, none of the following throw `SyntaxError` in a 3.12.3 REPL.)

    Generic[x]
    Generic[*x]
    Generic[*x, y]
    Generic[y, *x]
    Generic[x := 1]
    Generic[x := 1, y := 2]

So introducting

    flexible_expression: expression | assignment_expression | starred_item

end then switching `subscription` to use `flexible_expression` sorts that.

But then we need to field `yield` - for which any of the following are
apparently valid:

    yield x
    yield x,
    yield x, y
    yield *x,
    yield *x, *y

Introducing a separate `yield_list` is the simplest way I've been figure out to
do this - separating out the special case of `starred_item ,`.

(cherry picked from commit 7d3497f617)

Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 13:03:28 -07:00
Jelle Zijlstra
d4cd39097e
[3.12] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124580)
Using a standard library class makes this test difficult to maintain
as other tests and other parts of the stdlib may create subclasses,
which may still be alive when this test runs depending on GC timing.
(cherry picked from commit 08a467b537)
2024-09-26 06:40:40 +00:00
Jelle Zijlstra
7ce138fa9b
[3.12] gh-123242: Note that type.__annotations__ may not exist (GH-124557) (#124562)
Closes GH-123242. The real criterion is that the attribute does not
exist on heap types, but I don't think we should discuss heap vs.
static types in the language reference.
(cherry picked from commit 99b23c64de)
2024-09-25 16:27:10 -07:00
Alex Waygood
d2068c65a6
[3.12] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124558) 2024-09-25 23:01:19 +00:00
Miss Islington (bot)
92bc714033
[3.12] GH-103484: Fix permanently redirects reported by linkcheck (GH-124144) (GH-124152)
Fix redirects reported by linkcheck, update docs conf.py checks.
(cherry picked from commit 0a32c6959c)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-16 20:53:46 -07:00
Miss Islington (bot)
c6ee0b3e7b
[3.12] gh-123580: Fix signed_number token in documentation (GH-123582) (GH-123624)
gh-123580: Fix `signed_number` token in documentation (GH-123582)

(cherry picked from commit 9e079c220b)

Co-authored-by: CBerJun <121291537+CBerJun@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-09-04 11:19:29 +02:00
Miss Islington (bot)
252ed6da4d
[3.12] gh-123621: Fix datamodel.rst with proper dict notation (GH-123648) (#123654)
gh-123621: Fix `datamodel.rst` with proper `dict` notation (GH-123648)
(cherry picked from commit cfbc841ef3)

Co-authored-by: Lipták Attila (Flash) <113017309+AttilaLiptak@users.noreply.github.com>
2024-09-03 20:00:53 +00:00
Miss Islington (bot)
acb19be799
[3.12] gh-123579: Document exclamation token (GH-123612) (#123638)
(cherry picked from commit 68fe5758bf)

Co-authored-by: Shaygan Hooshyari <sh.hooshyari@gmail.com>
2024-09-03 14:56:19 +00:00
Wei-Hsiang (Matt) Wang
d47d7e1124
[3.12] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123576) 2024-09-02 16:02:39 +02:00
Wei-Hsiang (Matt) Wang
d5abd02f36
[3.12] gh-123492: Remove unnecessary :func: parentheses (gh-123493) (#123512) 2024-08-30 20:09:55 +03:00
Miss Islington (bot)
92ad3be09b
[3.12] gh-122701: Fix wording of raw strings/bytes in lexical_analysis.rst (GH-122702) (#122915)
gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` (GH-122702)
(cherry picked from commit ea70439bd2)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-11 21:09:13 +00:00
Miss Islington (bot)
13c263c444
[3.12] gh-122511: Improve documentation for object identity of mutable/immutable types (GH-122512) (#122779)
gh-122511: Improve documentation for object identity of mutable/immutable types (GH-122512)
(cherry picked from commit 76bdeebef6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-08-07 14:56:40 +01:00
Miss Islington (bot)
1cd57b9937
[3.12] Remove outdated note about instance methods from datamodel.rst (GH-122471) (#122480)
Remove outdated note about instance methods from datamodel.rst (GH-122471)
(cherry picked from commit c68cb8e0c9)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-07-30 19:48:29 +00:00
Serhiy Storchaka
39dea212f4
[3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:08:33 +00:00
Miss Islington (bot)
20d145512a
[3.12] gh-120452: improve documentation about private name mangling (GH-120451) (#121716)
gh-120452: improve documentation about private name mangling (GH-120451)
(cherry picked from commit f4d6e45c1e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-13 15:11:33 +00:00
Miss Islington (bot)
8d3f44ad01
[3.12] gh-121355: Fix incorrect word in simple_stmts.rst (GH-121356) (#121363)
(cherry picked from commit 715ec630dd)

Co-authored-by: Jongbum Won <71166964+Wondaeng@users.noreply.github.com>
2024-07-04 13:43:31 +00:00
Miss Islington (bot)
b93386e1c4
[3.12] gh-114104: clarify asynchronous comprehension docs to match runtime behavior (GH-121175) (#121235)
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (GH-121175)
(cherry picked from commit 91313afdb3)

Co-authored-by: Danny Yang <yangdanny97@users.noreply.github.com>
2024-07-01 16:41:18 +00:00
Miss Islington (bot)
21a953613c
[3.12] doc: Mention the missing reflected special methods for all binary operations (GH-119931) (#120064)
doc: Mention the missing reflected special methods for all binary operations (GH-119931)
(cherry picked from commit bf5e1065f4)

Co-authored-by: Paulo Freitas <me@paulofreitas.me>
2024-06-29 12:12:46 +05:30
Miss Islington (bot)
709ef004df
[3.12] gh-120937: Reference weakref from the __del__ documentation (GH-120940) (#121062)
gh-120937: Reference weakref from the `__del__` documentation (GH-120940)
(cherry picked from commit 1c13b29d54)

Co-authored-by: chaen <christophe.haen@cern.ch>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-26 20:14:30 +00:00
Miss Islington (bot)
ae9b54bd48
[3.12] gh-120521: clarify except* documentation to allow tuples (GH-120523) (#120751)
(cherry picked from commit 58b3f11176)

Co-authored-by: Danny Yang <yangdanny97@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-19 12:06:52 -07:00
Miss Islington (bot)
5185951335
[3.12] annotations: expand documentation on "simple" assignment targets (GH-120535) (#120556)
This behavior is rather surprising and it was not clearly specified.

(cherry picked from commit 9e0b11eb21)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-06-15 15:24:21 +00:00
Miss Islington (bot)
045be7729e
[3.12] gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (GH-119364) (#119870)
gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (GH-119364)
(cherry picked from commit 015b1fdd0a)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-05-31 18:24:11 +01:00
Miss Islington (bot)
4d85f0ae76
[3.12] Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is global (GH-114009) (#118128)
Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is global (GH-114009)
(cherry picked from commit 1558d99316)

Co-authored-by: Quazi Irfan <quazirfan@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-21 01:50:01 +00:00
Hugo van Kemenade
a844e83b06
[3.12] Add 'The Python 2.3 Method Resolution Order' (GH-116435) (#117885)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-15 14:14:16 +03:00
Miss Islington (bot)
9359fdd6fa
[3.12] Add information about negative indexes to sequence datamodel doc (GH-110903) (#117238)
Co-authored by Terry Jan Reedy
(cherry picked from commit c2276176d5)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2024-03-25 22:40:28 +00:00
Miss Islington (bot)
05b2b30436
[3.12] gh-56374: Clarify documentation of nonlocal (GH-116942) (#117023)
Define 'nonlocal scopes' in a way that excludes class scopes.
Rearrange the rest of the doc.  Add "Programmer's note".

(cherry picked from commit 025ef7a5f7)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-03-19 18:05:27 +00:00
Miss Islington (bot)
1627c1ee01
[3.12] gh-107607: Update comment about utf-8 BOM being ignored (GH-107858) (#117016)
(cherry picked from commit 7f64ae30dd)
Co-authored-by: Terry Jan Reedy tjreedy@udel.edu
2024-03-19 12:00:40 -04:00
Miss Islington (bot)
6383b14957
[3.12] gh-116881: Remove erroneous or redundant grammar NULL (GH-116885) (#116951)
In Lexical Analysis f-strings section, NULL in the description
of 'literal character' means '\0'.  In the format_spec grammar
production, it is wrong with that meaning and redundant if
instead interpreted as <nothing>.  Remove it there.
(cherry picked from commit 4e45c6c54a)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-03-18 10:37:26 -04:00
Serhiy Storchaka
1e75fe1468
[3.12] gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298) (GH-116450)
(cherry picked from commit 808a77612f)
2024-03-07 08:21:25 +00:00
Miss Islington (bot)
5b73ed4b66
[3.12] gh-72971: Clarify the special no-TypeError behavior for equality (GH-110729) (#116254)
(cherry picked from commit 67f742e03a)

Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
2024-03-03 01:55:59 +01:00
Miss Islington (bot)
694874b7dc
[3.12] gh-104219: Document that idunders can return NotImplemented (GH-104220) (#116210)
(cherry picked from commit 2713c2abc8)

Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-01 16:08:59 +00:00
Miss Islington (bot)
240e5f613b
[3.12] Docs: mark up NotImplemented using the :data: role throughout the docs (GH-116135) (#116147)
(cherry picked from commit dbe44f150c)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-29 20:53:51 +00:00
Miss Islington (bot)
59ec6e8f23
[3.12] Erase some unnecessary quotes on data model doc (GH-113521) (#115896)
Thanks to Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) for help with this bug.

(cherry picked from commit f7455864f2)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2024-02-24 23:30:14 -05:00
Kirill Podoprigora
ae6c01d9d2
[3.12] gh-115572: Move codeobject.replace() docs to the data model … (#115633)
* [3.12] gh-115572: Move `codeobject.replace()` docs to the data model (GH-115631)
(cherry picked from commit 0c80da4c14)

Co-authored-by: Daler <48939169+daler-sz@users.noreply.github.com>

* Remove note about copy.replace

---------

Co-authored-by: Daler <48939169+daler-sz@users.noreply.github.com>
2024-02-18 14:38:33 +00:00
Miss Islington (bot)
c2a3c3c643
[3.12] gh-115405: add versionadded tag for co_qualname in code objects documentation (GH-115411) (#115412)
gh-115405: add versionadded tag for co_qualname in code objects documentation (GH-115411)
(cherry picked from commit de07941729)

Co-authored-by: Christophe Papazian <114495376+christophe-papazian@users.noreply.github.com>
2024-02-13 16:16:22 +00:00
Miss Islington (bot)
7cc205872d
[3.12] gh-114552: Update __dir__ method docs: it allows returning an iterable (GH-114662) (#115234)
gh-114552: Update `__dir__` method docs: it allows returning an iterable (GH-114662)
(cherry picked from commit e19103a346)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-02-10 08:50:31 +00:00
Miss Islington (bot)
b3d01fc56d
[3.12] Clarify one-item tuple (GH-114745) (#114757)
A 'single tuple' means 'one tuple, of whatever length.
Remove the unneeded and slightly distracting parenthetical 'singleton' comment.
(cherry picked from commit a1332a99cf)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-01-30 18:50:28 +00:00
Miss Islington (bot)
01910d6845
[3.12] gh-101100: Fix sphinx warnings in reference/import.rst (GH-114646) (#114652)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-01-27 09:37:08 -07:00
Miss Islington (bot)
f9979212f8
[3.12] gh-101100: Fix Sphinx warnings in reference/expressions.rst (GH-114194) (#114436)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-01-22 18:50:20 +02:00
Miss Islington (bot)
f7d5d936ab
[3.12] Fix the confusing "User-defined methods" reference in the datamodel (GH-114276) (#114365) 2024-01-21 03:52:04 +00:00
Miss Islington (bot)
74a6b7f639
[3.12] gh-114070: fix token reference warnings in expressions.rst (GH-114169) (#114192)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-01-17 16:46:02 +00:00
Miss Islington (bot)
d577225104
[3.12] datamodel: Fix a typo in `object.__init_subclass__` (GH-111599) (#114004)
datamodel: Fix a typo in ``object.__init_subclass__`` (GH-111599)
(cherry picked from commit a47353d587)

Co-authored-by: InSync <122007197+InSyncWithFoo@users.noreply.github.com>
2024-01-12 23:05:48 +00:00
Miss Islington (bot)
eb22afb004
[3.12] Docs: Amend codeobject.co_lines docs; end number is exclusive (GH-113970) (#113987)
The end number should be exclusive, not inclusive.
(cherry picked from commit e68806c712)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-01-12 15:10:43 +00:00
Miss Islington (bot)
082998c3af
[3.12] gh-113664: Improve style of Big O notation (GH-113695) (GH-113909)
Use cursive to make it looking like mathematic formulas.
(cherry picked from commit a8629816c6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-10 13:08:08 +00:00
Alex Waygood
d3f2051eec
[3.12] Document the co_lines method on code objects (#113682) (#113686)
(cherry-picked from commit f1f8392432)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-03 20:09:15 +00:00
Miss Islington (bot)
3b5c2da079
[3.12] gh-81094: Refer to PEP 318 in compound_statements.rst (GH-113588) (#113643)
Co-authored-by: John D. McDonald <43117960+Rasputin2@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-02 08:46:01 +00:00
Miss Islington (bot)
08d3b5dd30
[3.12] gh-113313: Note that slice support is not required for all sequences. (gh-113377) (gh-113382) 2023-12-21 22:00:52 +00:00
Miss Islington (bot)
44101e9cd3
[3.12] Fix typo in datamodel docs (GH-113314) (#113316)
Fix typo in datamodel docs (GH-113314)
(cherry picked from commit 5a7cc667f8)

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-12-20 12:05:33 +00:00
Miss Islington (bot)
38a41820ee
[3.12] Docs: Add label to grammar spec for linking from PEPs (GH-113235) (#113239)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-12-17 19:30:10 +00:00
Miss Islington (bot)
dc568dd226
[3.12] gh-101100: Fix Sphinx nitpicks in library/inspect.rst and reference/simple_stmts.rst (GH-113107) (#113109)
gh-101100: Fix Sphinx nitpicks in `library/inspect.rst` and `reference/simple_stmts.rst` (GH-113107)
(cherry picked from commit 4b3cb082da)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-14 13:37:47 +00:00