Commit graph

125071 commits

Author SHA1 Message Date
Miss Islington (bot)
3ecf63754e
[3.13] Fix a compiler warning in _randommodule.c (GH-141058) (#141064)
Fix a compiler warning in _randommodule.c (GH-141058)

The test just before the cast ensures that the cast cannot overflow.

Fix the warning on 32-bit Windows:

    Modules\_randommodule.c(525,28): warning C4244: '=': conversion
    from 'uint64_t' to 'Py_ssize_t', possible loss of data
(cherry picked from commit 4ac16dd109)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-05 19:08:41 +00:00
Miss Islington (bot)
91b85c5346
[3.13] gh-139313: Improve docs on XML security (GH-139460) (GH-141066)
Clarify that:
- it takes parsing for an attack
- that some doors are closed by default
- only Expat version 2.7.2 has all the fixes
- use of the bundle depends on configuration
(cherry picked from commit baa9f33897)

Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-11-05 19:06:37 +00:00
Miss Islington (bot)
2dd0a6ad9c
[3.13] Docs: Fix cached calls count in factorial example (gh-140882) (gh-141032)
Co-authored-by: Clifford Gama <cliffygamy@gmail.com>
2025-11-05 12:15:05 -06:00
Victor Stinner
43882c7c4e
[3.13] gh-140815: Fix faulthandler for invalid/freed frame (#140921) (#140985)
gh-140815: Fix faulthandler for invalid/freed frame (#140921)

faulthandler now detects if a frame or a code object is invalid or
freed.

Add helper functions:

* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()

_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.

(cherry picked from commit a84181c31b)
2025-11-05 18:39:28 +01:00
Miss Islington (bot)
7ac9048ce9
[3.13] gh-141004: Document PyMemoryView_Type (GH-141034) (GH-141055)
gh-141004: Document `PyMemoryView_Type` (GH-141034)
(cherry picked from commit 3f6aca1be4)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-11-05 16:51:31 +00:00
Jan-Eric Nitschke
15db2421ce
[3.13] gh-138772: Add tests for Turtle.dot() signature (GH-138773) (#140992)
Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-05 17:24:46 +02:00
Miss Islington (bot)
a3756c6ea0
[3.13] gh-141004: Document missing iterator types in the C API (GH-141010) (GH-141047)
gh-141004: Document missing iterator types in the C API (GH-141010)

Add documentation for each of the following:

- PyByteArrayIter_Type
- PyBytesIter_Type
- PyListIter_Type
- PyListRevIter_Type
- PySetIter_Type
- PyTupleIter_Type
- PyRangeIter_Type
- PyLongRangeIter_Type
- PyDictIterKey_Type
- PyDictRevIterKey_Type
- PyDictIterValue_Type
- PyDictRevIterValue_Type
- PyDictIterItem_Type
- PyDictRevIterItem_Type

---------
(cherry picked from commit 35528fccdc)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-05 14:22:32 +00:00
Hugo van Kemenade
64bf92179b
[3.13] Omit Python/perf_jit_trampoline.c from the **/*jit* CODEOWNERS rule (GH-136519) (#140988)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2025-11-05 14:24:12 +02:00
Miss Islington (bot)
82ed4d0707
[3.13] gh-141004: Document Py_UNICODE_{HIGH, LOW}_SURROGATE functions (GH-141019) (GH-141026)
gh-141004: Document `Py_UNICODE_{HIGH, LOW}_SURROGATE` functions (GH-141019)
(cherry picked from commit bfe54810c4)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-04 21:24:52 +00:00
Filip Łajszczak
d76e411891
[3.13] gh-139434: Update selected RFC 2822 references to RFC 5322 (GH-139435) (#141024)
Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
(cherry picked from commit ce1bb85d28)
2025-11-04 16:22:31 -05:00
Miss Islington (bot)
426daef412
[3.13] Docs: Fix typo in email.headerregistry.rst (GH-140965) (#141021)
Docs: Fix typo in `email.headerregistry.rst` (GH-140965)

Fix missing 'Header' suffix on header class name in `email.headerregistry.rst`
(cherry picked from commit 97d8dda980)

Co-authored-by: Guo Ci <zguoci@gmail.com>
2025-11-04 19:35:14 +00:00
Miss Islington (bot)
fbfa3e3fe8
[3.13] gh-134817: Restore accidentally deleted line in documentation. (GH-141013) (GH-141017)
(cherry picked from commit 66c86c6)
2025-11-04 18:57:32 +00:00
Miss Islington (bot)
aa4dd4ece8
[3.13] Document that returning sys.monitoring.DISABLE in response to a global event raises ValueError (GH-140726) (GH-141015)
Document that returning `sys.monitoring.DISABLE` in response to a global event raises `ValueError` (GH-140726)
(cherry picked from commit 8a7dbb7a68)

Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-04 18:36:40 +00:00
Hugo van Kemenade
56146059d3
[3.13] gh-139590: Stricter ruff rules for Tools/wasm (GH-139752) (#140986)
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-11-04 18:17:57 +00:00
Miss Islington (bot)
ac0ecb0f5d
[3.13] gh-140826 Remove the wrong documents about comparison behavior on winreg.HKEYType (GH-140999) (GH-141003)
(cherry picked from commit c3f9702f04)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2025-11-04 16:36:46 +00:00
Miss Islington (bot)
fd9be78f4e
[3.13] gh-140979: Fix off-by-one error in the RE code validator (GH-140984) (GH-141000)
It was too lenient and allowed MARK opcodes with too large value.
(cherry picked from commit 1326d2a808)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-04 18:16:40 +02:00
Miss Islington (bot)
551d68d8cf
[3.13] Fix minor typo: 'web site' -> 'website' (GH-140561) (GH-140977)
(cherry picked from commit 08115d241a)

Co-authored-by: commitWithTisha <tishaa1010@gmail.com>
2025-11-04 14:11:15 +01:00
Miss Islington (bot)
ee894d2abb
[3.13] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140983)
(cherry picked from commit fa9c3eefd4)

Co-authored-by: Abhishek Tiwari <Abhi210@users.noreply.github.com>
2025-11-04 11:17:29 +00:00
Miss Islington (bot)
e7507967f8
[3.13] Docs: Fix a typo in idle.rst (Chitespace -> Whitespace) (GH-140946) (#140954)
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-11-04 10:02:17 +02:00
Hugo van Kemenade
5a2bcbd452
[3.13] Fix minor typos and wording in C API docs (GH-140955) (#140967)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-04 09:46:18 +02:00
Jiucheng(Oliver)
10af8404b4
[3.13] gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367) (#140917)
[3.13] gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367)
(cherry picked from commit 6d45cd8dbb)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
RDM: Like the change made in a earlier PR to the folder, we can/must use 'maxlen' as a stand in for 'unlimited' when computing line lengths when max_line_length is 0 or None; otherwise the computation results in a traceback.
2025-11-02 15:20:29 -05:00
Miss Islington (bot)
b8910fc444
[3.13] Docs: avoid informal formulation in Doc/c-api/conversion.rst (GH-140898) (#140913)
Docs: avoid informal formulation in `Doc/c-api/conversion.rst` (GH-140898)
(cherry picked from commit 173cc53d9f)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-11-02 13:57:03 +00:00
Sebastian Pipping
bc36bd1786
[3.13] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139367)
* gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (#139234)

Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.

(cherry picked from commit f04bea44c3)
(cherry picked from commit 68a1778b77)
2025-11-02 12:39:11 +00:00
Miss Islington (bot)
6ba31ca5d5
[3.13] Docs: fix some grammatical errors in Doc/c-api/dict.rst (GH-140899) (#140902)
Docs: fix some grammatical errors in `Doc/c-api/dict.rst` (GH-140899)
(cherry picked from commit d12cbf2865)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-11-02 08:39:12 +00:00
Miss Islington (bot)
9a3a147988
[3.13] gh-140874: Upgrade bundled pip to 25.3 (GH-140876) (gh-140880)
* gh-140874: Upgrade bundled pip to 25.3 (GH-140876)

Upgrade bundled pip to 25.3
(cherry picked from commit d440a0f96c)

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>

* Update Misc/NEWS.d/next/Library/2025-11-01-00-36-14.gh-issue-140874.eAWt3K.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

---------

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
Co-authored-by: Paul Moore <p.f.moore@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-01 12:42:15 +00:00
Łukasz Langa
9ab89c026a
[3.13] gh-136065: Fix quadratic complexity in os.path.expandvars() (GH-134952) (GH-140845)
(cherry picked from commit f029e8db62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-10-31 17:58:09 +01:00
Serhiy Storchaka
c6c57f1a0b
[3.13] Fix the versionchanged directive for gh-137836 (GH-140859) 2025-10-31 16:55:54 +00:00
Miss Islington (bot)
0329bd11c7
[3.13] gh-137836: Support more RAWTEXT and PLAINTEXT elements in HTMLParser (GH-137837) (GH-140842)
* the "plaintext" element
* the RAWTEXT elements "xmp", "iframe", "noembed" and "noframes"
* optionally RAWTEXT (if scripting=True) element "noscript"
(cherry picked from commit a17c57eee5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-31 16:08:42 +00:00
Mikhail Efimov
eec9257aa5
[3.13] gh-140551: Fix dict crash if clear is called at lookup stage (GH-140558) (#140744)
* gh-140551: Fix `dict` crash if `clear` is called at `lookup` stage (#140558)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-10-30 22:36:49 +05:30
Donghee Na
b0f12b5980
[3.13] gh-137821: Fix wrongly tested json.decoder.scanstring (gh-140781) 2025-10-30 22:51:10 +09:00
Miss Islington (bot)
32c3dcc7a4
[3.13] gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) (GH-140785)
(cherry picked from commit 327dbbedff)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-30 11:31:54 +00:00
Mikhail Efimov
08cacb2a14
[3.13] gh-140576: Fixed crash produced by lexer in case of dedented zero byte (GH-140583) (#140762) 2025-10-29 14:33:55 +00:00
Miss Islington (bot)
62a3b6b0d9
[3.13] gh-140082: Forward colorizing from libregrtest to unittest (GH-140083) (#140755)
gh-140082: Forward colorizing from libregrtest to unittest (GH-140083)

libregrtest redirects test output to a file as part of its operation.
When `unittest` checks to see if it should colorize with
`isatty(sys.stdout)` that fails resulting in no colorizing of the
unittest output.

Update `libregrtest` to set `FORCE_COLOR=1` when redirecting test output
so that unittest will do color printing.
(cherry picked from commit 6ff62ac4fb)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 12:55:54 +00:00
Miss Islington (bot)
b3649a7122
[3.13] gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747) (#140754)
gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747)
(cherry picked from commit 376559bf54)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 12:51:18 +00:00
Cody Maloney
a1a71efa6e
[3.13] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611) (#140730)
* [3.13] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611)

While `RawIOBase.readinto` should return a count of bytes between 0 and
the length of the given buffer, it is not required to. Add validation
inside RawIOBase.read() that the returned byte count is valid.
(cherry picked from commit 0f0a362768)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>

* fixup: Use older attribute name

---------

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 13:31:57 +01:00
Miss Islington (bot)
f3476c6507
[3.13] gh-139588: Increase maximum LaTeX list depth (GH-140709) (#140725)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-28 20:05:32 +00:00
Miss Islington (bot)
a026f02fd4
[3.13] gh-140657: Don't rerun test_import single phase init test (GH-140712) (#140714)
gh-140657: Don't rerun test_import single phase init test (GH-140712)

test_basic_multiple_interpreters_main_no_reset() leaks memory:
import_in_subinterp() is called with postcleanup=False.
(cherry picked from commit c6d4c79c9a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-28 17:29:44 +00:00
Miss Islington (bot)
bec053c184
[3.13] GH-140590: Fix setstate for functools.partial C-module (GH-140671) (#140699)
GH-140590: Fix setstate for functools.partial C-module (GH-140671)

(cherry picked from commit d26686a7f8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-28 18:14:14 +05:30
Miss Islington (bot)
9c8eade20c
[3.13] gh-140634: Fix a reference counting bug in os.sched_param.__reduce__() (GH-140667) (GH-140686)
(cherry picked from commit 364ae607d8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-27 20:05:10 +00:00
Shamil
fd6df66624
[3.13] gh-140301: Fix memory leak in subinterpreter PyConfig cleanup (GH-140303) (#140684)
[3.13] gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303)
(cherry picked from commit a615fb49c9)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-27 19:42:13 +00:00
Hugo van Kemenade
2d29aa2036
[3.13] gh-92266: Update pre-commit (GH-139411) (#139760)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-10-27 16:14:48 +02:00
Victor Stinner
ec5f5418f9
[3.13] gh-140487: Fix Py_RETURN_NOTIMPLEMENTED in limited C API 3.11 (GH-140636) (GH-140670)
Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE have already been
fixed by commit 9258f3da91 (issue gh-134989).

(cherry picked from commit c636477523)
2025-10-27 14:43:59 +01:00
Miss Islington (bot)
0e3b47b839
[3.13] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140659)
(cherry picked from commit 3416e7c8dc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-27 14:08:09 +01:00
Miss Islington (bot)
134e2f8d7f
[3.13] Docs: Replace "encoder" with "decoder" in Doc/c-api/codec.rst (GH-140613) (#140662)
Docs: Replace "encoder" with "decoder" in `Doc/c-api/codec.rst` (GH-140613)
(cherry picked from commit d12086e822)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-27 09:51:34 +00:00
Bartosz Sławecki
15f92e66eb
[3.13] gh-137568: Ignore startup file in test_dumb_terminal_exits_cleanly (GH-140295) (GH-140632)
(cherry picked from commit 06c779474c)
2025-10-26 15:36:47 +00:00
Sebastian Pipping
7abbf51839
[3.13] gh-140593: Fix a memory leak in function my_ElementDeclHandler of pyexpat (GH-140602) (#140630)
[3.13] gh-140593: Fix a memory leak in function `my_ElementDeclHandler` of `pyexpat` (GH-140602)

Ensure that the memory allocated for the content model
passed to `my_ElementDeclHandler` is freed in all error
paths.

(cherry picked from commit e34a5e3304)
2025-10-26 15:22:20 +00:00
Miss Islington (bot)
d64b05b284
[3.13] Docs: Fix a grammatical error in Doc/c-api/codec.rst (GH-140612) (#140617)
Docs: Fix a grammatical error in `Doc/c-api/codec.rst` (GH-140612)
(cherry picked from commit 33b2ca80bb)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-26 09:45:42 +00:00
Miss Islington (bot)
9d1a83255c
[3.13] Standardize translation of Doc/bugs.rst (GH-137449) (GH-140282)
Standardize translation of `Doc/bugs.rst` (GH-137449)
(cherry picked from commit 869bb6948e)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-26 10:07:09 +01:00
Miss Islington (bot)
df86b18f7f
[3.13] Fix typo in Doc/c-api/code.rst (GH-140586) (#140592)
Fix typo in `Doc/c-api/code.rst` (GH-140586)
(cherry picked from commit d74a96366d)

Co-authored-by: RayXu <140802139+F18-Maverick@users.noreply.github.com>
2025-10-25 15:43:00 +00:00
Miss Islington (bot)
01f9c51caa
[3.13] Remove unreachable break statements in _ctypes_test.c (GH-140585) (#140588)
Remove unreachable break statements in _ctypes_test.c (GH-140585)
(cherry picked from commit 2a1c9bd616)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-25 18:39:54 +03:00