Commit graph

1011 commits

Author SHA1 Message Date
Miss Islington (bot)
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 (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
2025-03-22 08:00:54 +00:00
Miss Islington (bot)
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 <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-18 12:51:02 +01:00
Miss Islington (bot)
c68a8722be
[3.13] gh-121970: Replace .. coroutine{method,function} with :async: (GH-130448) (#130465)
(cherry picked from commit 5ec4bf86b7)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-22 18:00:49 +00:00
Miss Islington (bot)
692d36f1fc
Doc: update term "namespace package" (GH-129251)
(cherry picked from commit e65e9f9062)
2025-02-15 15:10:24 +09:00
Miss Islington (bot)
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 <skirpichev@gmail.com>
2025-01-21 20:12:43 +00:00
Miss Islington (bot)
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 <greg@krypto.org>
2024-12-24 10:55:57 -08:00
Carol Willing
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 <beoms424@gmail.com>
2024-12-02 15:10:59 +01:00
Miss Islington (bot)
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 <jmarshall@hey.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-14 10:46:58 +01:00
Miss Islington (bot)
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 <103735539+vivodi@users.noreply.github.com>
2024-11-11 06:54:26 +00:00
Shantanu
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 <1324225+hugovk@users.noreply.github.com>
2024-11-10 01:01:05 +00:00
Hugo van Kemenade
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
Miss Islington (bot)
00ff23f06d
[3.13] gh-60712: Include the "object" type in the lists of documented types (GH-103036) (GH-126197)
gh-60712: Include the "object" type in the lists of documented types (GH-103036)

* add test for the predefined object's attributes

* Include the "object" type in the lists of documented types

* remove 'or' from augment tuple

* 📜🤖 Added by blurb_it.

* Add cross-reference to news



* Fix format for the function parameter



* Add space



* add reference for the 'object'



* add reference for NotImplemented



* Change ref:`string <textseq>`  as class:`str`



* remove hyphen from `newly-created`

* Update Doc/reference/datamodel.rst

'dictionaries' to 'dict'



* Update predefined attribute types in testPredefinedAttrs

* Change `universal type` as `top type`

* Don't mention about the top type

* Update the description of richcmpfuncs

* Update Doc/library/stdtypes.rst



* Revert: Hierarchy Section in Data Model Documentation

* Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity.

* Update Doc/reference/datamodel.rst



* Remove blank line



* Use ref:`str <textseq>` instead of :class:`str



* Revert changes the description of Other Built-in Types in stdtypes.rst

* Update Doc/reference/datamodel.rst



---------

(cherry picked from commit 4f826214b3)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 13:16:38 -07:00
Miss Islington (bot)
7966c7d69e
[3.13] gh-125461: Remove Python 2 from identifiers in doc (GH-125462) (GH-125464)
gh-125461: Remove Python 2 from identifiers in doc (GH-125462)

Remove Python 2 from identifiers in doc
(cherry picked from commit 5dac0dceda)

Co-authored-by: Paul Hoffman <phoffman@proper.com>
2024-10-14 08:49:35 -07:00
Alex Waygood
aa4da1e468
[3.13] gh-101100: Consolidate documentation on ModuleType attributes (#124709) (#125208)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-09 20:03:30 +01:00
Miss Islington (bot)
0e0a2dadec
[3.13] gh-70870: Clarify dual usage of 'free variable' (GH-122545) (#125088)
The term "free variable" has unfortunately become genuinely
ambiguous over the years (presumably due to the names of
some relevant code object instance attributes).

While we can't eliminate that ambiguity at this late date, we can
at least alert people to the potential ambiguity by describing
both the formal meaning of the term and the common
alternative use as a direct synonym for "closure variable".

---------

(cherry picked from commit 27390990fa)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-08 17:58:47 +10:00
Emily Morehouse
9a1b9d5254
[3.13] gh-125072: Add label for assignment expressions; update tracked section for assignment expression topic (GH-125074) (#125077)
(cherry picked from commit 447a15190d)
2024-10-08 02:14:34 +01:00
Miss Islington (bot)
4ff32aac9e
[3.13] gh-124370: Add "howto" for free-threaded Python (GH-124371) (#124860)
gh-124370: Add "howto" for free-threaded Python (GH-124371)
(cherry picked from commit 68e384c217)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-03 09:24:42 -07:00
Serhiy Storchaka
5bf32d1300
[3.13] gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613) (#124735)
* Setting the __module__ attribute for a class now removes the
  __firstlineno__ item from the type's dict.
* The _collections_abc and _pydecimal modules now completely replace the
  collections.abc and decimal modules after importing them. This
  allows to get the source of classes and functions defined in these
  modules.
* inspect.findsource() now checks whether the first line number for a
  class is out of bound.
(cherry picked from commit 69a4063ca5)
2024-09-29 21:21:40 -07:00
Emily Morehouse
0a125d9029
[3.13] gh-81263: Add assignment expressions to help (GH-124641) (#124713)
gh-81263: Add assignment expressions to `help` (#124641)

* Add assignment expression (:=) to `help`

* Update index for Assignment Expressions to include pair of `assignment; expression`
2024-09-27 15:21:58 -07:00
Miss Islington (bot)
cf98f39103
[3.13] GH-65961: Document the deprecation of __package__ and __cached__ (GH-124377) (#124380)
* GH-65961: Document the deprecation of `__package__` and `__cached__` (GH-124377)

The code changes for warning related to `__package__` landed in Python 3.12. `__cached__` doesn't have any changes as it isn't used but only set by the import system.
(cherry picked from commit 67201ad53f)

---------

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Barry Warsaw <barry@python.org>
2024-09-27 18:53:35 +00:00
Jelle Zijlstra
b27e2273be
[3.13] gh-123242: Note that type.__annotations__ may not exist (GH-124557) (#124569)
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-26 16:57:50 -07:00
Miss Islington (bot)
a0799223ae
[3.13] gh-101100: Make __subclasses__ doctest stable (GH-124577) (#124579)
gh-101100: Make __subclasses__ doctest stable (GH-124577)

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)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 13:56:06 -07:00
Miss Islington (bot)
410e0efc54
[3.13] gh-115528: Update language reference for PEP 646 (GH-121181) (#124632)
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:55:32 -07:00
Alex Waygood
9f2e6ca199
[3.13] gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) (#124556) 2024-09-25 17:29:48 -07:00
Miss Islington (bot)
6867604781
[3.13] GH-103484: Fix permanently redirects reported by linkcheck (GH-124144) (#124151)
GH-103484: Fix permanently redirects reported by linkcheck (GH-124144)

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-24 00:43:04 +00:00
Miss Islington (bot)
e4516911fe
[3.13] gh-123580: Fix signed_number token in documentation (GH-123582) (GH-123623)
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:18:42 +02:00
Miss Islington (bot)
aeb39b72b2
[3.13] gh-123621: Fix datamodel.rst with proper dict notation (GH-123648) (#123653)
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:12:17 +00:00
Miss Islington (bot)
95ebca1e99
[3.13] gh-123579: Document exclamation token (GH-123612) (#123637)
(cherry picked from commit 68fe5758bf)

Co-authored-by: Shaygan Hooshyari <sh.hooshyari@gmail.com>
2024-09-03 15:07:13 +00:00
Wei-Hsiang (Matt) Wang
05dcc81601
[3.13] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123577) 2024-09-02 16:00:04 +02:00
Wei-Hsiang (Matt) Wang
9f5f2b7128
[3.13] gh-123492: Remove unnecessary :func: parentheses (gh-123493) (#123513) 2024-08-30 20:14:48 +03:00
Miss Islington (bot)
1788eb786b
[3.13] gh-122701: Fix wording of raw strings/bytes in lexical_analysis.rst (GH-122702) (#122914)
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:20:07 +00:00
Miss Islington (bot)
59be613137
[3.13] gh-122511: Improve documentation for object identity of mutable/immutable types (GH-122512) (#122778)
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 16:41:26 +01:00
Irit Katriel
545a328eae
[3.13] gh-122445: populate only modified fields in __static_attributes__ (#122446) (#122621)
gh-122445: populate only modified fields in __static_attributes__ (#122446)

(cherry picked from commit 498376d7a7)
2024-08-02 19:26:57 +01:00
Miss Islington (bot)
e65aea96c3
[3.13] Remove outdated note about instance methods from datamodel.rst (GH-122471) (#122479)
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 20:00:36 +00:00
Serhiy Storchaka
a45d9051ed
[3.13] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122012)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:13:08 +00:00
Miss Islington (bot)
4af9c05e78
[3.13] gh-120452: improve documentation about private name mangling (GH-120451) (#121715)
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:21:30 +00:00
Miss Islington (bot)
77ced7601c
[3.13] gh-121355: Fix incorrect word in simple_stmts.rst (GH-121356) (#121362)
(cherry picked from commit 715ec630dd)

Co-authored-by: Jongbum Won <71166964+Wondaeng@users.noreply.github.com>
2024-07-04 13:53:41 +00:00
Miss Islington (bot)
931c168219
[3.13] gh-114104: clarify asynchronous comprehension docs to match runtime behavior (GH-121175) (#121234)
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:51:43 +00:00
Miss Islington (bot)
cbbd95328d
[3.13] doc: Mention the missing reflected special methods for all binary operations (GH-119931) (#120063)
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:35 +05:30
Miss Islington (bot)
d7cd71c72a
[3.13] gh-120937: Reference weakref from the __del__ documentation (GH-120940) (#121061)
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:24:25 +00:00
Miss Islington (bot)
adef569278
[3.13] gh-120521: clarify except* documentation to allow tuples (GH-120523) (#120750)
(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:07:04 -07:00
Miss Islington (bot)
29bbd5f8e4
[3.13] annotations: expand documentation on "simple" assignment targets (GH-120535) (#120555)
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:35:57 +00:00
Miss Islington (bot)
cf8f292a36
[3.13] gh-118934: Fix PyEval_GetLocals docs (PEP 667) (GH-119934)
PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)
(cherry picked from commit fd6cd621e0)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-06-02 05:57:17 +00:00
Miss Islington (bot)
24e3a8a9a6
[3.13] gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (GH-119364) (#119869)
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 17:27:55 +00:00
Miss Islington (bot)
db64dae745
[3.13] gh-74929: PEP 667 general docs update (gh-119291)
* expand on What's New entry for PEP 667 (including porting notes)
* define 'optimized scope' as a glossary term
* cover comprehensions and generator expressions in locals() docs
* review all mentions of "locals" in documentation (updating if needed)
* review all mentions of "f_locals" in documentation (updating if needed)

(cherry picked from commit e870c852c0)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-05-21 21:35:26 +10:00
Serhiy Storchaka
153b3f7530
gh-118465: Add __firstlineno__ attribute to class (GH-118475)
It is set by compiler with the line number of the first line of
the class definition.
2024-05-06 12:02:37 +03:00
Guido van Rossum
9c13d9e37a
gh-74929: Rudimentary docs for PEP 667 (#118581)
This is *not* sufficient for the final 3.13 release, but it will do for beta 1:

- What's new entry
- Updated changelog entry (news blurb)
- Mention the proxy for f_globals in the datamodel and Python frame object docs

This doesn't have any C API details (what's new refers to the PEP).
2024-05-05 15:31:26 +00:00
Jelle Zijlstra
ca269e58c2
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Quazi Irfan
1558d99316
Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is global (#114009)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-20 18:42:51 -07:00
Irit Katriel
8a01fd7b9b
gh-115775: Add whatsnew entry about __static_attributes__ (GH-117909)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-19 12:57:31 +02:00