Commit graph

15259 commits

Author SHA1 Message Date
Miss Islington (bot)
8a25840a2a
[3.14] gh-145633: Fix struct.pack('f') on s390x (GH-146422) (#146460)
gh-145633: Fix struct.pack('f') on s390x (GH-146422)

Use PyFloat_Pack4() to raise OverflowError.
Add more tests on packing/unpacking floats.
(cherry picked from commit 8de70b31c5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-26 11:38:42 +00:00
Pablo Galindo Salgado
58c5eda24c
[3.14] gh-146308: Fix error handling issues in _remote_debugging module (GH-146309) (#146398)
(cherry picked from commit ae6adc9079)
2026-03-25 01:05:47 +00:00
Miss Islington (bot)
cbb1985b72
[3.14] GH-131296: Suppress clang-cl warnings in socketmodule.c (GH-131821) (GH-146339)
(cherry picked from commit cc8e6d2703)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2026-03-24 00:27:20 +01:00
Miss Islington (bot)
c334bdee7b
[3.14] GH-131296: Fix clang-cl warning on Windows in socketmodule.h (GH-131832) (GH-146340)
(cherry picked from commit 59e2330cf3)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2026-03-24 00:27:01 +01:00
Serhiy Storchaka
e31c551216
[3.14] gh-145264: Do not ignore excess Base64 data after the first padded quad (GH-145267) (GH-146326)
Base64 decoder (see binascii.a2b_base64(), base64.b64decode(), etc)
no longer ignores excess data after the first padded quad in non-strict
(default) mode.  Instead, in conformance with RFC 4648, it ignores the
pad character, "=", if it is present before the end of the encoded data.
(cherry picked from commit 4561f6418a)
2026-03-24 00:20:26 +01:00
Miss Islington (bot)
69a37be21c
[3.14] gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) (GH-146274)
(cherry picked from commit c30fae4bea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-03-22 11:55:13 +00:00
AN Long
6bd5992d8b
[3.14] gh-129849: Add tests for Py_tp_bases (GH-143208) (#146225)
(cherry picked from commit 6f8867a676)
2026-03-21 15:22:58 +05:30
Miss Islington (bot)
a2a45d7d13
[3.14] gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165) (#146223)
gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165)
(cherry picked from commit 6450b1d142)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-20 16:44:19 +00:00
Serhiy Storchaka
2105187546
[3.14] Improve tests for the PyUnicodeWriter C API (GH-146157) (GH-146180)
Add tests for corner cases: NULL pointers and out of range values.
(cherry picked from commit ab47892c32)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-20 11:44:25 +00:00
Miss Islington (bot)
5feedc7593
[3.14] gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113) (#146130)
gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113)

The function can fail on a memory allocation failure.

Bug reported by devdanzin.
(cherry picked from commit 724c7c8146)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-18 17:47:39 +00:00
Miss Islington (bot)
6980b94c3a
[3.14] gh-146076: Fix crash when a ZoneInfo subclass is missing a _weak_cache (GH-146082) (GH-146116)
(cherry picked from commit 3b06d68d8a)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 15:23:46 +00:00
Serhiy Storchaka
a005f323b7
[3.14] gh-144545: Improve handling of default values in Argument Clinic (GH-146016) (GH-146052)
* Add the c_init_default attribute which is used to initialize the C variable
  if the default is not explicitly provided.
* Add the c_default_init() method which is used to derive c_default from
  default if c_default is not explicitly provided.
* Explicit c_default and py_default are now almost always have precedence
  over the generated value.
* Add support for bytes literals as default values.
* Improve support for str literals as default values (support non-ASCII
  and non-printable characters and special characters like backslash or quotes).
* Fix support for str and bytes literals containing trigraphs, "/*" and "*/".
* Improve support for default values in converters "char" and "int(accept={str})".
* Converter "int(accept={str})" now requires 1-character string instead of
  integer as default value.
* Add support for non-None default values in converter "Py_buffer": NULL,
  str and bytes literals.
* Improve error handling for invalid default values.
* Rename Null to NullType for consistency.
(cherry picked from commit 99e2c5eccd)
2026-03-17 10:55:15 +00:00
Miss Islington (bot)
0548f41053
[3.14] gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (GH-144992) (#146019)
gh-144984: Fix crash in Expat's `ExternalEntityParserCreate` error paths (GH-144992)
(cherry picked from commit e6b9a14069)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-17 01:49:39 +01:00
Miss Islington (bot)
a1f2fefc32
[3.14] gh-144986: Fix memory leak in atexit.register() (GH-144987) (#145020)
gh-144986: Fix memory leak in atexit.register() (GH-144987)
(cherry picked from commit 50c14719fb)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-03-16 13:56:05 +05:30
Miss Islington (bot)
e0a8a6da90
[3.14] gh-145986: Avoid unbound C recursion in conv_content_model in pyexpat.c (CVE 2026-4224) (GH-145987) (#145995)
gh-145986: Avoid unbound C recursion in `conv_content_model` in `pyexpat.c` (CVE 2026-4224) (GH-145987)

Fix C stack overflow (CVE-2026-4224) when an Expat parser
with a registered `ElementDeclHandler` parses inline DTD
containing deeply nested content model.

---------
(cherry picked from commit eb0e8be3a7)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-15 22:13:58 +00:00
Stan Ulbrych
87fac9b8ee
[3.14] gh-145783: Propagate errors raised in NEW_TYPE_COMMENT (GH-145784) (#145926) 2026-03-13 18:08:04 +00:00
bkap123
485699216f
[3.14] gh-145446: Add critical section in functools module for PyDict_Next (GH-145487) (GH-145879)
(cherry picked from commit 17eb0354ff)
2026-03-13 13:21:04 +01:00
Miss Islington (bot)
59be951e15
[3.14] gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659) (GH-145747)
(cherry picked from commit 2d35f9bc1c)

Includes test fix-up from GH-145788
(cherry picked from commit aa4240ebea)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
2026-03-12 10:45:31 +01:00
Miss Islington (bot)
e9f3664a51
[3.14] Fix integer overflow for formats "s" and "p" in the struct module (GH-145750) (GH-145772)
(cherry picked from commit 4d0dce0c8d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-10 17:26:01 +00:00
Miss Islington (bot)
7e389260aa
[3.14] gh-145743: Fix inconsistency after calling Struct.__init__() with invalid format (GH-145744) (GH-145763)
Only set the format attribute after successful (re-)initialization.
(cherry picked from commit 3f33bf83e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-10 16:55:58 +00:00
Stan Ulbrych
6d9221c7d1
[3.14] gh-145376: Fix various reference leaks (GH-145377) (GH-145712)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-03-10 16:31:02 +01:00
Ramin Farajpour Cami
7c624d4f31
[3.14] gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) (GH-145630) 2026-03-09 17:41:39 +01:00
Miss Islington (bot)
0e423f1c26
[3.14] gh-145376: Fix refleak in queuemodule.c out-of-memory path (GH-145543) (#145622)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaafac4)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-08 13:32:51 +05:30
Miss Islington (bot)
c23dd527e0
[3.14] gh-145376: Fix crashes in md5module.c and hmacmodule.c (GH-145422) (#145610)
gh-145376: Fix crashes in `md5module.c` and `hmacmodule.c` (GH-145422)

Fix a possible NULL pointer dereference in `md5module.c` and a double-free in `hmacmodule.c`.
Those crashes only occur in error paths taken when the interpreter fails to allocate memory.
(cherry picked from commit c1d7768321)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-06 21:06:32 +00:00
Sam Gross
7b9508f4b0
[3.14] gh-144513: Skip critical section locking during stop-the-world (gh-144524) (#145570) 2026-03-06 12:00:17 -05:00
Miss Islington (bot)
f42692838c
[3.14] gh-145301: Fix double-free in hashlib and hmac module initialization (GH-145321) (#145523)
gh-145301: Fix double-free in hashlib and hmac module initialization (GH-145321)
(cherry picked from commit 6acaf659ef)


gh-145301: Fix double-free in hashlib and hmac initialization

Co-authored-by: krylosov-aa <krylosov.andrew@gmail.com>
2026-03-05 04:13:02 +00:00
Miss Islington (bot)
3c99c16231
[3.14] gh-144475: Fix reference management in partial_repr (GH-145362) (GH-145470)
(cherry picked from commit 671a953dd6)

Co-authored-by: bkap123 <97006829+bkap123@users.noreply.github.com>
2026-03-03 16:40:23 +01:00
Miss Islington (bot)
96c9394c8a
[3.14] gh-142781: Fix type confusion in zoneinfo weak cache (GH-142925) (GH-145419)
(cherry picked from commit b611db491d)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-03 12:48:05 +01:00
Miss Islington (bot)
504436870b
[3.14] gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390) (#145433)
gh-145335: Fix crash when passing -1 as fd in os.pathconf (GH-145390)
(cherry picked from commit 5c3a47b94a)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-02 18:33:47 +00:00
Miss Islington (bot)
86c846735b
[3.14] Fix unlikely potential reference leak in _locale._getdefaultlocale (GH-145250) (GH-145302)
It occurs in a code which perhaps never executed.
(cherry picked from commit 6ea84b2726)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-27 08:31:11 +00:00
Miss Islington (bot)
bc6a7a2b0c
[3.14] gh-142787: Handle empty sqlite3 blob slices (GH-142824) (#145297)
(cherry picked from commit 06b0920f12)

Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
2026-02-27 01:12:51 +01:00
Pablo Galindo Salgado
ded533b1fa
[3.14] gh-144316: Fix missing exception in _remote_debugging with debug=False (GH-144442) (#145280) 2026-02-26 22:39:48 +00:00
Stan Ulbrych
0701ce636c
[3.14] gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) (GH-145189)
(cherry picked from commit 56c4f10d6e)
2026-02-25 00:27:09 +02:00
Miss Islington (bot)
35a7a6767e
[3.14] _struct.c: Fix UB from integer overflow in prepare_s (GH-145158) (#145162)
`_struct.c`: Fix UB from integer overflow in `prepare_s` (GH-145158)

Avoid possible undefined behaviour from signed overflow in `struct` module

As discovered via oss-fuzz.
(cherry picked from commit fd0400585e)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-24 01:18:32 +00:00
Sam Gross
bbb0f2d880
[3.14] gh-144777: Fix data races in IncrementalNewlineDecoder (gh-144971) (#145143) 2026-02-23 15:25:03 +00:00
Bénédikt Tran
1decc7ee20
[3.14] gh-142516: fix reference leaks in ssl.SSLContext objects (GH-143685) (#145075)
* [3.14] gh-142516: fix reference leaks in `ssl.SSLContext` objects (GH-143685)
(cherry picked from commit 3a2a686cc4)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* fix backport
2026-02-21 13:31:23 -08:00
Bénédikt Tran
dcf96d0ed6
[3.14] gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (GH-143699) (#145073)
Fix an issue where passing invalid arguments to `os.posix_spawn[p]` functions
raised a SystemError instead of a TypeError, and allow to explicitly use `None`
for `scheduler` and `setpgroup` as specified in the docs.

(cherry picked from commit 347fc438cf)
2026-02-21 16:04:31 +01:00
Miss Islington (bot)
07dbda5a57
[3.14] gh-144809: Make deque copy atomic in free-threaded build (gh-144966) (#145053)
(cherry picked from commit 70da972f97)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-02-20 15:47:46 -05:00
Serhiy Storchaka
a3b6be9317
[3.14] gh-140652: Fix a crash in _interpchannels.list_all() after closing a channel (GH-143743) (GH-144954)
(cherry picked from commit 3f50432e31)
2026-02-18 13:29:34 +00:00
Miss Islington (bot)
907958c4ba
[3.14] gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) (GH-144633)
gh-144601: Avoid sharing exception objects raised in a `PyInit` function across multiple interpreters (GH-144602)
(cherry picked from commit fd6b639a49)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-02-16 10:37:46 -05:00
Serhiy Storchaka
bcabbd02f6
[3.14] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871)
(cherry picked from commit 8b7b5a9946)

Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 14:25:43 +02:00
Miss Islington (bot)
53b8e64150
[3.14] gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843) (#144858)
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)

In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638ca06)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-02-16 03:10:23 +00:00
Miss Islington (bot)
5b0c1f780f
[3.14] gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892) (#144786)
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892)
(cherry picked from commit 82b92e3cd1)

Co-authored-by: Priyanshu Singh <priyanshu2282@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-14 17:07:32 +00:00
Zachary Ware
c7ceb75ada
[3.14] gh-144551: Update CI to use latest OpenSSL versions (GH-144794) (#144799)
[3.14] gh-144551: Update CI to use latest OpenSSL versions

Also update _ssl_data_35.h to include an added symbol from 3.5.5.

(cherry picked from commit b933ef9261)
2026-02-13 22:31:27 +02:00
Miss Islington (bot)
ac9e9e2c8f
[3.14] gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281) (GH-144753)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
(cherry picked from commit e66f4a5a9c)

Co-authored-by: James <snoopjedi@gmail.com>
2026-02-12 17:22:05 +00:00
Serhiy Storchaka
4d3e8c1c85
[3.14] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144731)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16)

Co-authored-by: William Meehan <wmeehan@fb.com>
2026-02-12 08:38:27 +00:00
Miss Islington (bot)
befa954efe
[3.14] gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630) (#144670)
gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630)
(cherry picked from commit cc81707e40)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2026-02-10 15:05:25 +00:00
Bartosz Sławecki
616e611844
[3.14] gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (GH-144595) (#144655) 2026-02-10 14:31:49 +00:00
Miss Islington (bot)
13b3dd0622
[3.14] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144626)
(cherry picked from commit a91b5c3fb5)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-10 14:01:10 +01:00
Miss Islington (bot)
2e3f0146f2
[3.14] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144499)
(cherry picked from commit d5cb9f6a9b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 14:21:54 +01:00