Commit graph

1058 commits

Author SHA1 Message Date
Miss Islington (bot)
284ab76d4e
[3.14] gh-110936: Reorder string literal definition in Lexical Analysis (GH-138063) (#138373)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-16 16:56:17 +03:00
Miss Islington (bot)
5ddd72afd8
[3.14] gh-138871: Clarify NameError exception in 'del' (GH-138881) (#138903)
Co-authored-by: Kian Eliasi <kian.elbo@gmail.com>
2025-09-16 16:54:37 +03:00
Miss Islington (bot)
a36981598c
[3.14] GH-138562: Remove `sort()` from the common sequence methods in the data model (GH-138563) (#138760)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:23:53 +03:00
Miss Islington (bot)
15ca9c6816
[3.14] gh-135676: Reword the Operators & Delimiters section(s) (GH-137713) (#138457)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:22:56 +03:00
Miss Islington (bot)
500abc41e8
[3.14] Docs: Small clarity change for `except*` (GH-121073) (#137494)
Co-authored-by: Greg Stein <gstein@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-11 12:14:33 +03:00
Miss Islington (bot)
829c81ae21
[3.14] GH-101100: Remove some entries from `nitpick_ignore` (GH-138464) (#138683)
* GH-101100: Remove some entries from ``nitpick_ignore`` (GH-138464)
(cherry picked from commit 22cb9ba8f9)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

* Update check-warnings.py

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-09 19:12:40 +03:00
Miss Islington (bot)
dee3428120
[3.14] gh-101100: Resolve reference warnings in reference/ (GH-138418) (#138680)
gh-101100: Resolve reference warnings in reference/ (GH-138418)
(cherry picked from commit 6831634eb7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-09 19:11:09 +03:00
Miss Islington (bot)
75c2d9f7c4
[3.14] gh-138297 Point link in docs for finally to try/else, instead of if/else (GH-138298) (#138381)
Co-authored-by: James Parrott <80779630+JamesParrott@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-09-08 18:09:31 +03:00
Miss Islington (bot)
1e1bfe7bbe
[3.14] gh-138191: Document `frame.f_generator` in the data model (GH-138540) (#138553)
Co-authored-by: dbXD320 <devanshbaghla320@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-06 19:59:36 +03:00
Miss Islington (bot)
f153e32cba
[3.14] GH-138465: Improve documentation for common sequence methods (GH-138474) (#138560)
GH-138465: Improve documentation for common sequence methods (GH-138474)
(cherry picked from commit 8ed1d53e62)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-06 08:51:48 +03:00
Miss Islington (bot)
28fcdda083
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.6.rst (GH-138411) (#138455)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 15:27:52 +00:00
Miss Islington (bot)
b0069f14af
[3.14] GH-101100: Resolve reference warnings in whatsnew/3.7.rst (GH-138410) (#138423)
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 <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 06:26:29 +00:00
Miss Islington (bot)
e817d1aa2b
[3.14] gh-132661: PEP 750 documentation: second pass (GH-137020) (#137392)
gh-132661: PEP 750 documentation: second pass (GH-137020)
(cherry picked from commit 4dae9b1ff1)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-16 09:21:29 +03:00
Miss Islington (bot)
4832ceaa78
[3.14] gh-135676: Lexical analysis: Reword String literals and related sections (GH-135942) (#137048)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 19:23:25 +03:00
Miss Islington (bot)
c59a60bdb4
[3.14] gh-132661: Document t-strings and templatelib (GH-135229) (#136974)
Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-07-22 13:32:00 +03:00
Miss Islington (bot)
ad6c90f5ba
[3.14] gh-135110: Fix misleading generator.close() documentation (GH-135152) (GH-135985)
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 <188690869+cdenihan@users.noreply.github.com>
2025-06-26 13:34:33 +00:00
Miss Islington (bot)
8ef0398238
[3.14] Docs: Add cross-reference for positional_item in the calls productionlist (GH-129977) (GH-135940)
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 <123lhw321@gmail.com>
2025-06-25 14:30:42 +00:00
Miss Islington (bot)
bb9927005f
[3.14] gh-135676: lexical analysis: Improve section on Numeric literals (GH-134850) (GH-135677)
gh-135676: lexical analysis: Improve section on Numeric literals (GH-134850)
(cherry picked from commit 21f3d15534)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-06-18 14:40:28 +00:00
Miss Islington (bot)
ee141f0277
[3.14] gh-135171: Update documentation for the generator expression (GH-135351) (#135524)
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 <storchaka@gmail.com>
Co-authored-by: Brian Skinn <brian.skinn@gmail.com>
2025-06-15 00:38:19 +00:00
Miss Islington (bot)
8b35651853
[3.14] gh-127833: Reword and expand the Notation section (GH-134443) (GH-135301)
Prepare the docs for using the notation used in the `python.gram`
file. If we want to sync the two, the meta-syntax should be the same.

Link the Full Grammar docs here; keep only a few extras.

Also, remove the distinction between lexical and syntactic rules,
except for whitespace handling.
With f- and t-strings, the line between the two is blurry.
(cherry picked from commit 28d91d06f1)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Colin Marquardt <cmarqu42@gmail.com>
2025-06-09 13:56:24 +00:00
Miss Islington (bot)
74f5667bd9
[3.14] gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734) (#134739)
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734)

* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
(cherry picked from commit 08c78e02fa)

Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-05-26 15:24:24 -04:00
Miss Islington (bot)
9ddc7c548d
[3.14] gh-119180: Updates to PEP 649/749 docs (GH-134640) (#134731)
gh-119180: Updates to PEP 649/749 docs (GH-134640)

- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.
(cherry picked from commit 7291eaba8b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 15:40:43 +00:00
Miss Islington (bot)
ebfd18b3f0
[3.14] gh-127833: lexical analysis: Improve section on Names (GH-131474) (#134423)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-26 11:00:17 +03:00
Miss Islington (bot)
6ea83e077e
[3.14] gh-134026: Fix grammar description of for statement (GH-134034) (GH-134424)
gh-134026: Fix grammar description of for statement (GH-134034)
(cherry picked from commit 4eacf3883d)

Co-authored-by: Yash Vijay <yash_vijay@outlook.com>
2025-05-21 18:43:07 +02:00
Miss Islington (bot)
a3475e68bb
[3.14] gh-119180: More documentation for PEP 649/749 (GH-133552) (#133902)
gh-119180: More documentation for PEP 649/749 (GH-133552)

The SC asked that the Appendix in PEP-749 be added to the docs.
(cherry picked from commit 3396df56d0)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-11 15:49:06 +00:00
Miss Islington (bot)
a020336256
[3.14] gh-127833: Add links to token types to the lexical analysis intro (GH-131468) (#133652)
gh-127833: Add links to token types to the lexical analysis intro (GH-131468)
(cherry picked from commit 45bb5ba61a)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 10:46:47 +01:00
Miss Islington (bot)
ca3e3b8a27
[3.14] gh-127833: lexical analysis: Add backticks to BOM example (GH-132407) (#133632)
gh-127833: lexical analysis: Add backticks to BOM example (GH-132407)
(cherry picked from commit 0552ce0fb2)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-05-08 01:40:41 +00:00
Hugo van Kemenade
b092705907 Python 3.14.0b1 2025-05-06 18:33:52 +03:00
Jelle Zijlstra
7cb86c5def
gh-132426: Add get_annotate_from_class_namespace replacing get_annotate_function (#132490)
As noted on the issue, making get_annotate_function() support both types and
mappings is problematic because one object may be both. So let's add a new one
that works with any mapping.

This leaves get_annotate_function() not very useful, so remove it.
2025-05-04 07:26:42 -07:00
Inada Naoki
b1f2304b20
doc: update co_flags reference (#132300)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-24 14:05:56 +00:00
Serhiy Storchaka
62ff86fa55
gh-130104: Call __rpow__ in ternary pow() if necessary (GH-130251)
Previously it was only called in binary pow() and the binary
power operator.
2025-04-16 18:32:41 +03:00
Hugo van Kemenade
29af6cee02 Python 3.14.0a7 2025-04-08 14:20:51 +03:00
Pablo Galindo Salgado
c2ac662f28
gh-131831: Implement PEP 758 – Allow except and except* expressions without parentheses (#131833) 2025-04-01 19:04:56 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
8b7d20d3a9
gh-131457: Fix typo in BNF description of function signatures (#131460) 2025-03-22 10:54:48 +03:00
Petr Viktorin
4bced29a74
gh-130587: Add hand-written docs for non-OP tokens (GH-130588)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2025-03-19 16:42:11 +01:00
Irit Katriel
ffc2f1dd1c
gh-130080: implement PEP 765 (#130087) 2025-03-17 20:48:54 +00:00
Petr Viktorin
30d5205849
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.)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-17 17:05:47 +01:00
sobolevn
5ec4bf86b7
gh-121970: Replace .. coroutine{method,function} with :async: (#130448)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-22 17:54:43 +00:00
Inada Naoki
e65e9f9062
Doc: update term "namespace package" (#129251) 2025-02-14 13:47:54 -05:00
Petr Viktorin
58a4357e29
gh-127833: Docs: Add a grammar-snippet directive & replace productionlist (GH-127835)
As a first step toward aligning the grammar documentation with Python's actual
grammar, this overrides the ReST `productionlist` directive to:
- use `:` instead of the `::=` symbol
- add syntax highlighting for strings (using a Pygments highlighting class)

All links and link targets should be preserved. (Unfortunately, this reaches
into some Sphinx internals; I don't see a better way to do exactly what
Sphinx does.)

This also adds a new directive, `grammar-snippet`, which formats the snippet
almost exactly like what's in the source, modulo syntax highlighting and
keeping the backtick character to mark links to other rules.
This will allow formatting the snippets as in the grammar file
(file:///home/encukou/dev/cpython/Doc/build/html/reference/grammar.html).

The new directive is applied to two simple rules in toplevel_components.rst

---------

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: William Ferreira <wqferr@gmail.com>
Co-authored-by: bswck <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-05 16:12:23 +01:00
Alex Willmer
a8dc6d6d44
gh-115911: Ignore PermissionError during import from cwd (#116131)
Ignore PermissionError when checking cwd during import

On macOS `getcwd(3)` can return EACCES if a path component isn't readable,
resulting in PermissionError. `PathFinder.find_spec()` now catches these and
ignores them - the same treatment as a missing/deleted cwd.

Introduces `test.support.os_helper.save_mode(path, ...)`, a context manager
that restores the mode of a path on exit.

This is allows finer control of exception handling and robust environment
restoration across platforms in `FinderTests.test_permission_error_cwd()`.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-26 19:00:28 +00:00
Sergey B Kirpichev
6105846390
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (#122847)
Thanks to Artur Chakhvadze for bugfix.
2025-01-21 20:04:07 +00:00
Gregory P. Smith
228f275737
gh-126664: revert: Use else instead of finally in docs explaining "with" (#128169)
Revert "gh-126664: Use `else` instead of `finally` in "The with statement" documentation. (GH-126665)"

This reverts commit 25257d61cf.
2024-12-22 09:47:41 +00:00
Sergey B Kirpichev
987311d42e
gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829)
"Generally, mixed-mode arithmetic combining real and complex variables should
be performed directly, not by first coercing the real to complex, lest the sign
of zero be rendered uninformative; the same goes for combinations of pure
imaginary quantities with complex variables." (c) Kahan, W: Branch cuts for
complex elementary functions.

This patch implements mixed-mode arithmetic rules, combining real and
complex variables as specified by C standards since C99 (in particular,
there is no special version for the true division with real lhs
operand).  Most C compilers implementing C99+ Annex G have only these
special rules (without support for imaginary type, which is going to be
deprecated in C2y).
2024-11-26 17:57:39 +02:00
Beomsoo Kim
94a7a4e22f
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
2024-11-15 13:02:34 -08:00
John Marshall
e0692f1165
Document that return-less user-defined functions return None (#126769)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-14 07:47:24 +00:00
Beomsoo Kim
494360afd0
gh-58749: Remove incorrect language spec claims about the global statement (GH-126523)
* Removes erroneous explanation of the `global` statement restrictions; a name declared as global can be subsequently bound using any kind of name binding operation.
* Updates `test_global.py` to also test various name-binding scenarios for global
variables to ensure correct behavior
2024-11-12 10:11:40 +10:00
vivodi
25257d61cf
gh-126664: Use else instead of finally in "The with statement" documentation. (GH-126665) 2024-11-10 22:47:56 -08:00
Hugo van Kemenade
450db61a78
Postpone module.__loader__ deprecation to Python 3.16 (#126482) 2024-11-09 16:48:33 -08:00
Hugo van Kemenade
eac41c5ddf
gh-101865: Docs: Keep co_lnotab deprecation for at least 3.14 (#126392) 2024-11-04 18:49:59 +02:00