Commit graph

119485 commits

Author SHA1 Message Date
Miss Islington (bot)
e32b752808
[3.12] gh-121671: Increase test coverage of ast.get_docstring (GH-121674) (GH-121690)
(cherry picked from commit 0a26aa5007)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-07-13 13:20:00 +00:00
Miss Islington (bot)
e4c8d89186
[3.12] gh-96765: Update ConfigParser.read() docs with multi-file read example (GH-121664) (GH-121688)
(cherry picked from commit fc21781175)

Co-authored-by: Timon Viola <44016238+timonviola@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-13 15:07:30 +02:00
Hugo van Kemenade
377ff9d584
[3.12] NEWS: Fix Sphinx warnings and increase threshold for new news nits (GH-121482) (#121514)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-13 12:54:50 +00:00
Miss Islington (bot)
32bbc36796
[3.12] gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663) (GH-121670)
gh-99242 Ignore error when running regression tests under certain conditions. (GH-121663)
(cherry picked from commit 0759cecd9d)

Co-authored-by: Bas Bloemsaat <bas@bloemsaat.com>
Co-authored-by: Kevin Diem <kg.diem@gmail.com>
2024-07-13 12:24:17 +02:00
Eric Snow
0ec761a96a
[3.12] gh-117482: Fix Builtin Types Slot Wrappers (gh-121632)
When builtin static types are initialized for a subinterpreter, various "tp" slots have already been inherited (for the main interpreter).  This was interfering with the logic in add_operators() (in Objects/typeobject.c), causing a wrapper to get created when it shouldn't.  This change fixes that by preserving the original data from the static type struct and checking that.

(cherry picked from commit 5250a03133, AKA gh-121602)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-11 21:20:08 +00:00
sobolevn
5492f84c14
[3.12] gh-121615: Improve module.rst C-API docs with better error descriptions (GH-121616) (#121619)
(cherry picked from commit e6264b44dc)
2024-07-11 09:12:06 +00:00
Miss Islington (bot)
847c803c13
[3.12] gh-107851: Fix spurious failures in fcntl eintr tests (GH-121556) (#121586)
On heavily loaded machines, the subprocess may finish its sleep before
the parent process manages to synchronize with it via a failed lock.

This leads to errors like:

  Exception: failed to sync child in 300.3 sec

Use pipes instead to mutually synchronize between parent and child.
(cherry picked from commit af9f6de6ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 14:54:45 +00:00
Miss Islington (bot)
06b2ba3831
[3.12] gh-121567: Improve slice C-API docs by mentioning exceptions (GH-121568) (#121579)
gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568)
(cherry picked from commit 84a5597b08)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-10 11:03:22 +00:00
Serhiy Storchaka
d87b03a88d
[3.12] Improve zipimport tests (GH-121535) (GH-121570) (GH-121576)
(cherry picked from commit 35c9399078)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 22a0bdbf9a)
2024-07-10 10:50:50 +00:00
Miss Islington (bot)
e47fec034e
[3.12] gh-121571: Do not use EnvironmentError in tests, use OSError instead (GH-121572) (#121575)
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572)
(cherry picked from commit e2822360da)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-10 10:35:29 +00:00
Miss Islington (bot)
ac4276cc7a
[3.12] GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428) (#121566)
GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428)
(cherry picked from commit 9585a1a2a2)

Co-authored-by: satori1995 <132636720+satori1995@users.noreply.github.com>
2024-07-10 08:06:41 +00:00
Miss Islington (bot)
e1a223431f
[3.12] gh-121533: Improve PyCell_[Get,Set] docs: mention the exceptions (GH-121534) (#121540)
gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534)
(cherry picked from commit 649d5b6d7b)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-09 19:03:12 +03:00
Miss Islington (bot)
f24f31656c
[3.12] gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335) (#121525)
gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335)
(cherry picked from commit facf9862da)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-09 15:06:40 +05:30
Sam Gross
4b04696527
[3.12] gh-121018: Fix typo in NEWS entry (GH-121510) (#121516)
(cherry picked from commit 218edaf0ff)
2024-07-08 17:19:29 -04:00
Miss Islington (bot)
da7f6745b8
[3.12] gh-121461: Fix os.path.normpath documentation indentation (GH-121466) (#121473)
gh-121461: Fix os.path.normpath documentation indentation (GH-121466)
(cherry picked from commit bf74db731b)

Co-authored-by: CBerJun <121291537+CBerJun@users.noreply.github.com>
2024-07-08 03:58:26 +00:00
Miss Islington (bot)
dcfe198867
[3.12] Regen `Doc/requirements-oldest-sphinx.txt` (GH-121437) (#121442)
Regen ``Doc/requirements-oldest-sphinx.txt`` (GH-121437)

regen dependencies
(cherry picked from commit 53e12025cd)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-07-06 18:11:28 +00:00
Miss Islington (bot)
e7cea781bd
[3.12] Update example of str.split, bytes.split (GH-121287) (#121416)
Update example of str.split, bytes.split (GH-121287)

In `{str,bytes}.strip(chars)`, multiple characters are not treated as a
prefix/suffix, but as individual characters. This may make users confuse
whether `split` has similar behavior.
Users may incorrectly expect that
`'Good morning, John.'.split(', .') == ['Good', 'morning', 'John']`

Adding a bit of clarification in the doc.

(cherry picked from commit 892e3a1b70)

Co-authored-by: Yuxin Wu <ppwwyyxxc@gmail.com>
Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2024-07-05 13:23:00 -07:00
Miss Islington (bot)
9e542f9a46
[3.12] gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391) (#121393)
gh-121390: tracemalloc: Fix tracebacks memory leak (GH-121391)

The tracemalloc_tracebacks hash table has traceback keys and NULL
values, but its destructors do not reflect this -- key_destroy_func is
NULL while value_destroy_func is raw_free. Swap these to free the
traceback keys instead.
(cherry picked from commit db39bc42f9)

Co-authored-by: Josh Brobst <jbrobst@proton.me>
2024-07-05 06:59:06 +00:00
Miss Islington (bot)
de86aaa160
[3.12] gh-90437: Fix __main__.py documentation wording (GH-116309) (GH-121386)
gh-90437: Fix __main__.py documentation wording (GH-116309)
(cherry picked from commit cb688bab08)

Co-authored-by: Ali Tavallaie <tavallaie@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Frank Dana <ferdnyc@gmail.com>
2024-07-04 22:55:54 +00:00
Miss Islington (bot)
4bf4cc22c4
[3.12] gh-121084: Fix test_typing random leaks (GH-121360) (#121372)
gh-121084: Fix test_typing random leaks (GH-121360)

Clear typing ABC caches when running tests for refleaks (-R option):
call _abc_caches_clear() on typing abstract classes and their
subclasses.
(cherry picked from commit 5f660e8e2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-04 18:00:08 +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)
81f575427e
[3.12] gh-117983: Defer import of threading for lazy module loading (GH-120233) (GH-121350)
gh-117983: Defer import of threading for lazy module loading (GH-120233)

As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.

An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.

For reference, here are benchmarks for the current main branch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       9.7 ms ±   0.7 ms    [User: 7.7 ms, System: 1.8 ms]
  Range (min … max):     8.4 ms …  13.1 ms    313 runs
```

And with this patch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       8.4 ms ±   0.7 ms    [User: 6.8 ms, System: 1.4 ms]
  Range (min … max):     7.2 ms …  11.7 ms    352 runs
```

Compare to:

```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
  Time (mean ± σ):       7.6 ms ±   0.6 ms    [User: 5.9 ms, System: 1.6 ms]
  Range (min … max):     6.7 ms …  11.3 ms    390 runs
```

This roughly halves the import time of importlib.util.
(cherry picked from commit 94f50f8ee6)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
2024-07-03 21:09:00 +00:00
Vinay Sajip
399e516d28
[3.12] gh-121035: Update PNG image for logging flow diagram. (GH-121323) (GH-121325)
(cherry picked from commit 26d24eeb90)
2024-07-03 13:02:02 +01:00
Vinay Sajip
10818024c8
[3.12] gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265) (GH-121321)
(cherry picked from commit 089835469d)
2024-07-03 11:40:26 +01:00
Vinay Sajip
c3f393c8ad
[3.12] gh-121035: Improve logging flow diagram for dark/light modes. (GH-121254) (GH-121316)
(cherry picked from commit bfe0e4d769)
2024-07-03 10:48:34 +01:00
Miss Islington (bot)
4ade7723e8
[3.12] docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) (#121310)
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237)
(cherry picked from commit 4232976b02)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2024-07-03 13:50:02 +05:30
Miss Islington (bot)
e5a19b981d
[3.12] gh-121196: Document dict.fromkeys params as pos-only (GH-121197) (#121243)
gh-121196: Document `dict.fromkeys` params as pos-only (GH-121197)
(cherry picked from commit 1dc9a4f6b2)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-01 20:37:19 +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)
dec9d916d2
[3.12] gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228) (#121231)
gh-121200: Fix test_expanduser_pwd2() of test_posixpath (GH-121228)

Call getpwnam() to get pw_dir, since it can be different than
getpwall() pw_dir.
(cherry picked from commit 02cb5fdee3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 16:05:30 +00:00
Miss Islington (bot)
e2a97d1db0
[3.12] gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207) (#121214)
gh-121200: Log pwd entry in test_expanduser_pwd2() (GH-121207)

Use subTest() to log the pwd entry in test_expanduser_pwd2() of
test_posixpath to help debugging.
(cherry picked from commit 05a6f8da60)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 10:02:34 +00:00
Miss Islington (bot)
3fba86e8b8
[3.12] gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191) (#121209)
gh-121084: Call _abc_registry_clear() when checking refleaks (GH-121191)

dash_R_cleanup() now calls _abc_registry_clear() before calling again
register().
(cherry picked from commit c766ad206e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 09:29:23 +00:00
Miss Islington (bot)
b80edafff2
[3.12] gh-121188: Sanitize invalid XML characters in regrtest (GH-121195) (#121205)
gh-121188: Sanitize invalid XML characters in regrtest (GH-121195)

When creating the JUnit XML file, regrtest now escapes characters
which are invalid in XML, such as the chr(27) control character used
in ANSI escape sequences.
(cherry picked from commit af8c3d7a26)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 08:47:38 +00:00
Miss Islington (bot)
99bc8589f0
[3.12] [doc] Update element positions and styles in logging flow diagram. (GH-121182) (GH-121184)
(cherry picked from commit 2a455bbe8f)
2024-06-30 14:53:10 +01:00
Victor Stinner
e0b9905ce6
[3.12] gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178) (#121180)
gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178)

(cherry picked from commit c3677befbe)

Co-authored-by: Yureka <yuka@yuka.dev>
2024-06-30 10:02:08 +00:00
Miss Islington (bot)
d4747727af
[3.12] GH-119054: Add alt text to pathlib inheritance diagram (GH-121158) (#121169)
GH-119054: Add alt text to pathlib inheritance diagram (GH-121158)
(cherry picked from commit 6b280a8498)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-29 17:53:27 +00:00
Barney Gale
d6eff187b5
[3.12] GH-119054: Fix pathlib docs subtitle word order (#121167)
When backporting GH-120505 to 3.12, I accidentally transposed
"Permissions and ownership" into "Ownership and permissions".
Swap it back for consistency with 3.13 and main.
2024-06-29 18:50:01 +01:00
Barney Gale
22dfecf1f5
[3.12] GH-119054: Add "Expanding and resolving paths" section to pathlib docs. (GH-120970) (#121156)
Add dedicated subsection for `home()`, `expanduser()`, `cwd()`,
`absolute()`, `resolve()` and `readlink()`. The position of this section
keeps all the `Path` constructors (`Path()`, `Path.from_uri()`,
`Path.home()` and `Path.cwd()`) near the top. Within the section, closely
related methods are kept adjacent. Specifically:

- `home()` and `expanduser()` (the former calls the latter)
- `cwd()` and `absolute()` (the former calls the latter)
- `absolute()` and `resolve()` (both make paths absolute)
- `resolve()` and `readlink()` (both read symlink targets)
- Ditto `cwd()` and `absolute()`
- Ditto `absolute()` and `resolve()`

The "Other methods" section is removed.

(cherry picked from commit d6d8707ff2)
2024-06-29 16:38:39 +01:00
Miss Islington (bot)
6a8cb77f49
[3.12] gh-121101: Document -Wall option (an alias for -Walways) (GH-121102) (#121147)
gh-121101: Document -Wall option (an alias for -Walways) (GH-121102)
(cherry picked from commit 0a1e8ff9c1)

Co-authored-by: Wim Jeantine-Glenn <jump@wimglenn.com>
2024-06-29 13:57:22 +05:30
Serhiy Storchaka
027902b56f
[3.12] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121145)
(cherry picked from commit 6d34938dc8)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-29 06:54:27 +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)
5c06b34665
[3.12] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136) (#121140)
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136)

PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added
(cherry picked from commit 92893fd8dc)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
2024-06-28 16:17:51 -07:00
Miss Islington (bot)
3a420de986
[3.12] gh-115986 Improve pprint docs formatting (GH-117401) (GH-121099)
gh-115986 Improve pprint docs formatting (GH-117401)

* Move pprinter parameters description to the table

The change improves readability.
Suggested in the GHGH-116085 PR discussion.

* Make pprint doc with params markup

* Fix formatting
Indentation of code blocks made them nested
"Version changed" is better placed after the code block

* Fix formatting for tests

* fix code indentation for autotests

* Fix identation for autotests

* Remove duplication of the parameters' description

* Rearrange parameters description in a correct order

---------

(cherry picked from commit 0890ad7c02)

Co-authored-by: Kerim Kabirov <the.privat33r+gh@pm.me>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-28 18:21:56 +02:00
Miss Islington (bot)
b31f7e2e90
[3.12] gh-120868: Fix breaking change in logging.config when using QueueHandler (GH-120872) (GH-121077)
(cherry picked from commit 7d9c68513d)
2024-06-28 17:10:53 +01:00
Serhiy Storchaka
8ea6cc14a5
[3.12] gh-121018: Fix more cases of exiting in argparse when exit_on_error=False (GH-121056) (GH-121129)
* parse_intermixed_args() now raises ArgumentError instead of calling
  error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
  error(). It is then caught at the higher level and error() is called if
  exit_on_error is true.
(cherry picked from commit 81a654a342)
2024-06-28 14:52:07 +00:00
Miss Islington (bot)
21a63b9c4c
[3.12] gh-121096: Ignore dlopen() leaks in Valgrind suppression file (GH-121097) (#121123)
gh-121096: Ignore dlopen() leaks in Valgrind suppression file (GH-121097)
(cherry picked from commit 6e63d84e43)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-28 11:17:30 +00:00
Miss Islington (bot)
2a68ed986e
[3.12] gh-105623 Fix performance degradation in logging RotatingFileHandler (GH-105887) (GH-121116)
The check for whether the log file is a real file is expensive on NFS
filesystems.  This commit reorders the rollover condition checking to
not do the file type check if the expected file size is less than the
rotation threshold.

(cherry picked from commit e9b4ec614b)

Co-authored-by: Craig Robson <craig@zhatt.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2024-06-28 09:09:38 +00:00
Miss Islington (bot)
a5048ad990
[3.12] gh-121035: Update logging flow chart to include the lastResort handler. (GH-121036) (GH-121105)
(cherry picked from commit 237baf4d7a)
2024-06-27 23:20:36 +01:00
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)
4868d1bab1
[3.12] gh-121018: Ensure ArgumentParser.parse_args with exit_on_error=False raises instead of exiting when given unrecognized arguments (GH-121019) (GH-121031)
(cherry picked from commit 0654336dd5)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-26 10:16:44 +00:00
Miss Islington (bot)
6de373d750
[3.12] gh-120380: fix Python implementation of pickle.Pickler for bytes and bytearray objects in protocol version 5. (GH-120422) (GH-120833)
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422)
(cherry picked from commit 7595e6743a)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-26 12:12:04 +02:00