Commit graph

56690 commits

Author SHA1 Message Date
Stan Ulbrych
57e88c1cf9
gh-145599, CVE 2026-3644: Reject control characters in http.cookies.Morsel.update() (#145600)
Reject control characters in `http.cookies.Morsel.update()` and `http.cookies.BaseCookie.js_output`.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
2026-03-16 14:43:43 +01:00
Ramin Farajpour Cami
e6b9a14069
gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (#144992)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-16 12:30:13 +00:00
Sacul
37121ef77e
gh-145866: Convert CALL_INTRINSIC_1 to leave its inputs on the stack to be cleaned up by _POP_TOP. (GH-145964) 2026-03-16 11:58:12 +00:00
Pieter Eendebak
3a24856447
gh-123471: make concurrent iteration over itertools.accumulate thread-safe (#144486) 2026-03-16 08:53:37 +00:00
AN Long
6f8867a676
gh-129849: Add tests for Py_tp_bases (#143208) 2026-03-16 13:59:55 +05:30
Gregory P. Smith
ee5318025b
gh-140814: Fix freeze_support() setting start method as side effect (GH-144608)
freeze_support() called get_start_method() without allow_none=True,
which locked in the default start method context. This caused a
subsequent set_start_method() call to raise "context has already been
set". Use allow_none=True and accept None as a matching value, since
spawn.freeze_support() independently detects spawned child processes.

Test that freeze_support() does not lock in the default start method,
which would prevent a subsequent set_start_method() call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-15 22:50:19 -07:00
Gregory P. Smith
83edae33a5
gh-145990: sort --help-env sections by environment variable name (GH-145997)
* sort --help-env alphabetically by name.
* add a sorting regression test in test_help_env.
2026-03-15 15:22:57 -07:00
Gregory P. Smith
b062f391cf
gh-145990: Sort python --help-xoptions by option name (GH-145991)
* Sort --help-xoptions alphabetically by name.
* add a sorting regression test in test_help_xoptions
2026-03-15 22:02:14 +00:00
Stan Ulbrych
eb0e8be3a7
gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) (#145987)
Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-15 22:46:06 +01:00
Gregory P. Smith
4a71946b8f
gh-122575: gh-142349: fix sys.flags tuple size (it unintentionally increased) (GH-145988)
the lazy imports PEP initial implementation (3.15 alpha) inadvertently incremented the length of the sys.flags tuple. In a way that did not do anything useful or related to the lazy imports setting (it exposed sys.flags.gil in the tuple). This fixes that to hard code the length to the 3.13 & 3.14 released length of 18 and have our tests and code comments make it clear that we've since stopped making new sys.flags attributes available via sequence index.
2026-03-15 20:30:01 +00:00
Matthieu Darbois
ec5e3a5a07
gh-145968: Fix base64.b64decode altchars translation in specific cases (GH-145969)
When altchars overlaps with the standard ones, the translation does not
always yield to the expected outcome.
2026-03-15 19:46:44 +02:00
Brian Schubert
e167e06f8c
Bump mypy to 1.19.1 (#145956) 2026-03-15 12:48:56 +03:00
Guido van Rossum
788c329117
gh-123720: When closing an asyncio server, stop the handlers (#124689) 2026-03-14 11:28:49 -07:00
Sacul
798070d8ca
gh-134584: Eliminate redundant refcounting in JIT for MATCH_CLASS (GH-144821) 2026-03-14 12:00:18 +00:00
Bénédikt Tran
97968564b6
gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (#143655) 2026-03-14 09:58:15 +00:00
Konstantin Vlasov
77c06f3da6
gh-145703: Fix asyncio.BaseEventLoop low clock resolution (#145706) 2026-03-14 11:07:30 +05:30
Petr Viktorin
747ef70faa
GH-60729: Revert "Add IEEE format wave audio support (GH-145384)" (GH-145928)
Revert "GH-60729: Add IEEE format wave audio support (GH-145384)"

This reverts commit 61f2a1a599 for now;
as tests fail on big-endian machines.
2026-03-13 17:51:23 +00:00
Pieter Eendebak
00a25859a9
gh-145376: Fix GC tracking in structseq.__replace__ (#145820) 2026-03-13 15:42:19 +00:00
Michiel W. Beijen
61f2a1a599
GH-60729: Add IEEE format wave audio support (GH-145384)
Co-authored-by: Lionel Koenig <lionelk@google.com>
2026-03-13 14:10:48 +01:00
Jason Yalim, PhD
f884dc6f70
gh-140715: Add %t and %n format codes support to strptime() (GH-144896)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-13 14:00:39 +01:00
devdanzin
0b6a2346e5
gh-145887: Use write() instead of stream.write() in PrettyPrinter._pprint_frozendict (#145894) 2026-03-13 12:57:35 +01:00
Serhiy Storchaka
962fb872eb
gh-145850: Change some implementation details in struct.Struct (GH-145851)
* calling it with non-ASCII string format will now raise a ValueError
  instead of UnicodeEncodeError
* calling it with non-ASCII bytes format will now raise a ValueError
  instead of struct.error
* getting the format attribute of uninitialized object will now raise
  an AttributeError instead of RuntimeError.
2026-03-13 13:05:41 +02:00
Stan Ulbrych
e1c224624a
gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (#145784) 2026-03-13 11:05:20 +00:00
Charlie Lin
7a65900764
gh-145717: Add a few Microsoft-specific MIME types, and synchronize between mimetypes module and tests (#145718)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-03-12 18:56:07 +02:00
Tan Long
e13f6dccd7
gh-140131: Fix REPL cursor position on Windows when module completion suggestion line hits console width (GH-140333) 2026-03-12 16:59:43 +01:00
Shamil
86a0756234
gh-140594: Fix an out of bounds read when feeding NUL byte to PyOS_StdioReadline() (#140910)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-12 10:46:36 +00:00
Serhiy Storchaka
72456309e9
gh-143715: Deprecate incomplete initialization of struct.Struct() (GH-145580)
* Struct.__new__() will require a mandatory argument (format)
* Calls of __init__() method with a different format argument on initialized
  Struct are deprecated

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-12 09:44:11 +02:00
Hai Zhu
f062014d38
gh-144540: Add _MAKE_HEAP_SAFE uop to eliminate unnecessary refcount operations in RETURN_VALUE and YIELD_VALUE (GH-144414) 2026-03-11 20:24:19 +00:00
Serhiy Storchaka
77d6d5d8fc
gh-145736: Fix Tkinter tests for Tk 8.7, 9.0 and 9.1 (GH-145738) 2026-03-11 21:01:03 +02:00
Victor Stinner
713be70175
gh-141510: Raise TypeError in PyDict_SetItem() on frozendict (#145564)
If the following functions get an unexpected frozendict,
raise TypeError instead of SystemError:

* PyDict_DelItem()
* PyDict_DelItemString()
* PyDict_Merge()
* PyDict_MergeFromSeq2()
* PyDict_Pop()
* PyDict_PopString()
* PyDict_SetDefault()
* PyDict_SetDefaultRef()
* PyDict_SetItem()
* PyDict_SetItemString()
* _PyDict_SetItem_KnownHash()
* PyDict_Update()

Co-authored-by: mohsinm-dev <mohsin.mdev@gmail.com>
2026-03-11 17:05:09 +01:00
Bénédikt Tran
4722202a1a
gh-139933: correctly suggest attributes for classes with a custom __dir__ (GH-139950)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-03-11 15:30:09 +01:00
Seth Michael Larson
42d754e34c
gh-141707: Skip TarInfo DIRTYPE normalization during GNU long name handling
Co-authored-by: Eashwar Ranganathan <eashwar@eashwar.com>
2026-03-11 13:47:55 +00:00
Thomas Kowalski
aa4240ebea
gh-145492: fix regression test for defaultdict factory repr (GH-145788) 2026-03-11 14:02:23 +01:00
Stefan Zetzsche
ece712197d
gh-145546: unittest.util: fix sorted_list_difference tail deduplication (GH-145547)
* fix(unittest.util): Deduplicate tail elements in sorted_list_difference

sorted_list_difference failed to deduplicate remaining elements when one
list was exhausted, causing duplicate values in the result.

Deduplicate before extending.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-11 13:21:22 +01:00
Shrey Naithani
5d6e8dd683
gh-145587: fix busy loop in multiprocessing.connection.wait on Windows (GH-145597)
Ensure wait() blocks for the specified timeout when object_list is empty, preventing 100% CPU usage. This aligns the Windows behavior with the Unix implementation.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-03-11 13:08:48 +01:00
Thomas Kowalski
c3955e049f
gh-145713: make bytearray.resize thread-safe on free-threading (#145714)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-11 12:57:26 +05:30
Sam Gross
665c1db94f
gh-142763: Fix race in ZoneInfo cache eviction (gh-144978)
The cache may be cleared between the evaluation of the if statement and the
call to popitem.
2026-03-10 14:47:58 -04:00
Stan Ulbrych
4d0dce0c8d
Fix integer overflow for formats "s" and "p" in the struct module (GH-145750) 2026-03-10 18:57:34 +02:00
Sam Gross
9c1c71066e
gh-145010: Fix Python.h compilation with -masm=intel (#145011) 2026-03-10 17:55:29 +01:00
Sergey B Kirpichev
c4333a1270
gh-144173: fix flaky test_complex.test_truediv() (#144355)
Previously, component-wise relative error bound was tested.  However,
such bound can't exist already for complex multiplication as one can be
used to perform subtraction of floating-point numbers, e.g. x and y for
z0=1+1j and z1=x+yj.

```pycon
>>> x, y = 1e-9+1j, 1+1j
>>> a = x*y*y.conjugate()/2;a
(1.0000000272292198e-09+1j)
>>> b = x*(y*y.conjugate()/2);b
(1e-09+1j)
>>> b == x
True
>>> (a.real-b.real)/math.ulp(b.real)
131672427.0
```
2026-03-10 17:40:51 +01:00
bkap123
9e0802330c
gh-145036: Fix data race for list capacity in free-threading (#145365)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-10 22:00:11 +05:30
Serhiy Storchaka
3f33bf83e8
gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744)
Only set the format attribute after successful (re-)initialization.
2026-03-10 18:29:23 +02:00
Charlie Lin
467507a651
gh-145697: Add .sql and .sqlite3 recognition in mimetypes (GH-145698)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
2026-03-10 16:21:33 +01:00
Hugo van Kemenade
7fbdc8fb54 Merge branch 'main' of https://github.com/python/cpython 2026-03-10 16:41:02 +02:00
Steve Dower
ae0d2875bc
gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL (GH-145159) 2026-03-10 14:58:32 +01:00
Matt Van Horn
2d35f9bc1c
gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659)
Co-Authored-By: Thomas Kowalski <thom.kowa@gmail.com>
2026-03-10 14:20:42 +01:00
Hugo van Kemenade
6024d3c6da Python 3.15.0a7 2026-03-10 14:31:15 +02:00
Kumar Aditya
728e4a075e
gh-142651: use NonCallableMock._lock for thread safety of call_count (#142922) 2026-03-10 12:11:12 +00:00
Hugo van Kemenade
368a26777a
gh-142927: Detect system theme in flame graph like in heatmap (#144885) 2026-03-10 13:38:48 +02:00
Sergey Miryanov
478a315b7a
GH-145247: Implement _PyTuple_FromPair() (#145325)
Implement _PyTuple_FromPair() and _PyTuple_FromPairSteal().

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-10 11:44:20 +01:00