Commit graph

119781 commits

Author SHA1 Message Date
Neil Schemenauer
5dd07ebc0c
[3.12] gh-116510: Fix a crash due to shared immortal interned strings. (gh-124541)
Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init.  In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it.  For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.
2024-09-26 18:04:03 -07:00
Neil Schemenauer
69fd1f218c
[3.12] gh-116510: Fix crash during sub-interpreter shutdown (gh-124536)
Fix a bug that can cause a crash when sub-interpreters use "basic"
single-phase extension modules.  Shared objects could refer to PyGC_Head
nodes that had been freed as part of interpreter shutdown.
2024-09-26 17:50:46 -07:00
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
Miss Islington (bot)
27890edd5a
[3.12] Programming FAQ: Mention object.__setattr__ as a technique for delegation (GH-124617) (#124625)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 12:19:57 -07:00
Miss Islington (bot)
a0c90b36f6
[3.12] gh-124378: Update test_ttk for Tcl/Tk 8.6.15 (GH-124545)
(cherry picked from commit fb6bd31cb7)

Co-authored-by: Zachary Ware <zach@python.org>
Co-authored-by: Marc Culler <culler@users.noreply.github.com>
2024-09-26 11:20:09 -05:00
Miss Islington (bot)
7c9db46a30
[3.12] Doc: Use the short version for daily downloads (GH-124602) (#124611)
Doc: Use the short version for daily downloads (GH-124602)
(cherry picked from commit 2c472d36b7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-26 17:01:39 +01:00
Miss Islington (bot)
4659026e1d
[3.12] gh-124498: Fix TypeAliasType not to be generic, when type_params=() (GH-124499) (#124604)
gh-124498: Fix `TypeAliasType` not to be generic, when `type_params=()` (GH-124499)
(cherry picked from commit abe5f799e6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-09-26 14:46:29 +00:00
Miss Islington (bot)
42432e5254
[3.12] gh-123560: Correct docs for "empty" format type for floats (GH-123561) (#124597)
gh-123560: Correct docs for "empty" format type for floats (GH-123561)
(cherry picked from commit 274d9ab619)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-09-26 12:53:58 +00:00
Miss Islington (bot)
51b62fb25a
[3.12] gh-124234: Improve docs for Mock.reset_mock (GH-124237) (#124592)
gh-124234: Improve docs for `Mock.reset_mock` (GH-124237)
(cherry picked from commit 19fed6cf6e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-09-26 12:24:27 +00:00
Tom Most
fca2623c2f
[3.12] Doc: Improve documentation for the `path argument in shutil.which()` (GH-124494) (#124576) 2024-09-26 08:56:30 +01: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
Kumar Aditya
2b54a4ebf1
[3.12] gh-124309: Modernize the staggered_race implementation to support e… (#124574)
gh-124309: Modernize the `staggered_race` implementation to support eager task factories (#124390)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
(cherry picked from commit de929f353c)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-09-26 05:39:46 +00:00
Miss Islington (bot)
48359c5c90
[3.12] For-else deserves its own section in the tutorial (GH-123946) (#124563)
(cherry picked from commit ffdc80e93d)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-25 17:08:07 -07: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)
ea5c650704
[3.12] Doc: Use `major.minor` for documentation distribution archive filenames (GH-124489) (#124535)
Doc: Use ``major.minor`` for documentation distribution archive filenames (GH-124489)
(cherry picked from commit 6318ffcba2)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-25 19:25:42 +00:00
Miss Islington (bot)
13565f1580
[3.12] gh-108951: Document how to terminate an asyncio.TaskGroup (GH-123837) (#123957)
gh-108951: Document how to terminate an asyncio.TaskGroup (GH-123837)

We don't want to add another API, since the recipe is straightforward and rarely needed.

The advantage is that we could backport this to the earliest Python version that has taskgroups (3.11, alas in security mode already, so we'll just do 3.12 and 3.13).
(cherry picked from commit ef05801ba0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-25 20:40:05 +05:30
Miss Islington (bot)
306368c9c8
[3.12] bpo-44864: Do not translate user-provided strings in ArgumentParser.add_subparsers() (GH-27667) (GH-124505)
Call _() on literal strings only.
(cherry picked from commit d3c76dff44)

Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
2024-09-25 10:28:27 +00:00
Miss Islington (bot)
cf06f5905f
[3.12] gh-123445: calendar: Improve descriptions for day and month attributes (GH-123483) (#124501)
gh-123445: calendar: Improve descriptions for day and month attributes (GH-123483)
(cherry picked from commit 8447c933da)

Co-authored-by: Mat S <mscull@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-25 09:31:17 +00:00
Miss Islington (bot)
391c4fce3e
[3.12] Adjust build_ubuntu_ssltests job to use cache for the correct OS version (GH-124482)
(cherry picked from commit 54dd77fb8c)

Authored-by: Zachary Ware <zach@python.org>
2024-09-25 01:50:18 +00:00
Jason R. Coombs
c60d97805f
[3.12] gh-121735: Fix module-adjacent references in zip files (gh-123037) (#124011) 2024-09-24 10:19:43 -07:00
Miss Islington (bot)
10cf0b8caf
[3.12] GH-87358: Add clarification about nargs and default argparse behaviour (GH-124094) (#124441)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-09-24 20:15:21 +03:00
Miss Islington (bot)
0c36c37841
[3.12] gh-124120: Document Annotated.__origin__ (GH-124125) (#124417)
gh-124120: Document `Annotated.__origin__` (GH-124125)
(cherry picked from commit faef3fa653)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-09-24 13:52:27 +00:00
Miss Islington (bot)
996e409401
[3.12] gh-59317: Improve parsing optional positional arguments in argparse (GH-124303) (GH-124437)
Fix parsing positional argument with nargs equal to '?' or '*' if it is
preceded by an option and another positional argument.
(cherry picked from commit 4a5e4aade4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-24 13:08:22 +00:00
Miss Islington (bot)
ed44377220
[3.12] gh-65169: Clarify prog default in argparse (GH-31602) (GH-124431)
(cherry picked from commit e69ff34e81)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2024-09-24 14:19:53 +03:00
Serhiy Storchaka
18542240c2
[3.12] gh-124188: Fix PyErr_ProgramTextObject() (GH-124189) (GH-124426)
* Detect source file encoding.
* Use the "replace" error handler even for UTF-8 (default) encoding.
* Remove the BOM.
* Fix detection of too long lines if they contain NUL.
* Return the head rather than the tail for truncated long lines.
(cherry picked from commit e2f710792b)
2024-09-24 08:53:54 +00:00
Miss Islington (bot)
7e2d414a59
[3.12] gh-72795: Make positional arguments with nargs='*' or REMAINDER non-required (GH-124306) (GH-124422)
This allows to use positional argument with nargs='*' and without default
in mutually exclusive group and improves error message about required
arguments.
(cherry picked from commit 3c83f9958c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-24 11:43:26 +03:00
Miss Islington (bot)
0e838b52fe
[3.12] gh-53780: Ignore the first "--" (double dash) between an option and command in argparse (GH-124275) (GH-124420)
(cherry picked from commit c578271366)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-24 07:54:32 +00:00
Miss Islington (bot)
e57fbe3d2d
[3.12] gh-63143: Fix parsing mutually exclusive arguments in argparse (GH-124307) (GH-124419)
Arguments with the value identical to the default value (e.g. booleans,
small integers, empty or 1-character strings) are no longer considered
"not present".
(cherry picked from commit 3094cd17b0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-24 07:42:34 +00:00
Miss Islington (bot)
1366fff609
[3.12] gh-124130: Increase test coverage for \b and \B in regular expressions (GH-124330) (GH-124414)
(cherry picked from commit b82f07653e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-24 06:56:45 +00:00
Miss Islington (bot)
d26d0a10b1
[3.12] Docs: Update two FAQs for Python 3 (GH-124247) (GH-124256)
(cherry picked from commit 5f01111594)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-09-24 09:42:00 +03:00
Alex Waygood
4b221bf878
[3.12] Bump Ruff to 0.6.7 (#124384) (#124391) 2024-09-23 23:09:27 +00:00
Miss Islington (bot)
db48e8f84d
[3.12] Doc: Add `make dist-no-html` (GH-124383) (#124388) 2024-09-23 23:19:18 +01:00
Miss Islington (bot)
7cc773ba3d
[3.12] GH-87041: Fix incorrect indentation in argparse help (GH-124230) (GH-124374)
In case of usage a long command along with max_help_position more than
the length of the command, the command's help was incorrectly started
on the new line.

(cherry picked from commit 7ee9921734)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Pavel Ditenbir <pavel.ditenbir@gmail.com>
2024-09-23 20:16:45 +00:00
Adam Turner
62dcb8e013
[3.12] GH-109975: Copyedit 3.13 What's New: Copyedit C API deprecations pending removal (GH-124336) (#124365)
(cherry picked from commit e7d465a607)
2024-09-23 19:31:28 +00:00
Savannah Ostrowski
b3709562ad
[3.12] GH-79714: Add mention of stderr for clarity to ArgumentParser.exit() (GH-123932) (GH-124356)
(cherry picked from commit 5f5c0b9c23)
2024-09-23 19:04:36 +00:00
Miss Islington (bot)
dd2066f274
[3.12] Replace the term Immutable with a Hashable in the sequence entry of the Glossary (GH-124350) (#124353)
Replace the term `Immutable` with a `Hashable` in the `sequence` entry of the Glossary (GH-124350)

The term `Immutable` in the `sequence` entry of the glossary is used incorrectly, in fact dicts accepts hashable keys, which is not the same as immutable.
(cherry picked from commit 6203ef35dd)

Co-authored-by: decorator-factory <42166884+decorator-factory@users.noreply.github.com>
2024-09-23 16:41:01 +00:00
Miss Islington (bot)
533b06c118
[3.12] Fix doctrees directory for the gettext builder (GH-122997) (#124339)
Fix doctrees directory for the gettext builder (GH-122997)
(cherry picked from commit 315a933a5b)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-09-23 14:37:10 +00:00
Miss Islington (bot)
d5aafe7713
[3.12] gh-124130: Notes on empty string corner case of category \B (GH-124133) (#124329)
gh-124130: Notes on empty string corner case of category `\B` (GH-124133)
(cherry picked from commit d3e79d75d1)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-23 07:05:24 +00:00
Terry Jan Reedy
7d505fecc9
[3.12] Backport idlelib typos (#124324)
See https://github.com/python/cpython/pull/123597.

(cherry picked from commit 1f4a49e)

Co-authored-by: abstractee
2024-09-22 21:57:36 -04:00
Miss Islington (bot)
cf39a5f22c
[3.12] gh-112938: IDLE - Fix uninteruptable hang when Shell gets rapid continuous output. (GH-124310) (#124319)
gh-112938: IDLE - Fix uninteruptable hang when Shell gets rapid continuous output. (GH-124310)

https://github.com/python/cpython/issues/88496 replaced text.update with text.update_idletasks in colorizer.py and outwin.py to fix test failures on macOS.  While theoretically correct, the result was Shell freezing when receiving continuous short strings to print.  Test: `while 1: 1`.

The guess is that there is no idle time in which to do the screen update.  Reverting the change in one of the files,
outwin, fixes the issue.  Colorizer runs ever 1/20 second and seems to work fine.

When running test-outwin on macOS, alias 'update'
to 'update_idletasks on the text used for testing.
(cherry picked from commit d5f95ec07b)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-09-22 20:07:52 +00:00
Miss Islington (bot)
25312403de
[3.12] gh-95468: Add more tests for "--" (double dash) in test_argparse (GH-124274) (GH-124276)
(cherry picked from commit baa3550bc3)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-22 20:42:14 +03:00
Miss Islington (bot)
fcfe78664b
[3.12] gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block 3fff::/20 (GH-124240) (#124283)
gh-124217, ipaddress: Add RFC 9637 reserved IPv6 block `3fff::/20` (GH-124240)
(cherry picked from commit db6eb3640a)

Signed-off-by: y5c4l3 <y5c4l3@proton.me>
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com>
2024-09-20 14:20:27 +02:00
Miss Islington (bot)
8606a2e91c
[3.12] Fix typo in XMLParser doc (GH-124129) (#124281)
Fix typo in XMLParser doc (GH-124129)
(cherry picked from commit 622368d99c)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-09-20 10:51:12 +00:00
Miss Islington (bot)
6644cd2c1b
[3.12] gh-124248: Fix crash in struct when processing 0p fields (GH-124251) (#124278)
gh-124248: Fix crash in struct when processing 0p fields (GH-124251)
(cherry picked from commit 63f196090f)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2024-09-20 10:29:43 +00:00
Miss Islington (bot)
6c6b044304
[3.12] gh-81691: Fix handling of multiple "--" (double dashes) in argparse (GH-124233) (GH-124267)
Only the first one has now been removed, all subsequent ones are now
taken literally.
(cherry picked from commit aae126748f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-20 13:02:30 +03:00
Miss Islington (bot)
eca08d3687
[3.12] gh-124040: Adjust few tests in testHypot/testDist to get exactly computed results (GH-124042) (GH-124236)
(cherry picked from commit 4420cf4dc9)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-09-19 08:30:19 +00:00
Miss Islington (bot)
e9578f6424
[3.12] gh-123934: Fix MagicMock not to reset magic method return values (GH-124038) (#124232)
gh-123934: Fix `MagicMock` not to reset magic method return values (GH-124038)
(cherry picked from commit 7628f67d55)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-09-19 08:18:01 +00:00
Miss Islington (bot)
a82a2f1597
[3.12] gh-124083: Skip test_signal.test_strsignal() on NetBSD (GH-124084) (#124224)
gh-124083: Skip test_signal.test_strsignal() on NetBSD (GH-124084)

Skip test_strsignal() on NetBSD due to TypeError.
(cherry picked from commit 36682c0914)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2024-09-18 21:47:18 +00:00
Miss Islington (bot)
2216c52828
[3.12] Fix make htmllive target (GH-124222)
Allow `make -C Doc htmllive` to work without manual venv activation

Set PATH to ensure that `sphinx-autobuild` can find `sphinx-build`.

(cherry picked from commit 9a6e2336e4)

Authored-by: Zachary Ware <zach@python.org>
2024-09-18 16:12:17 -05:00