Commit graph

14410 commits

Author SHA1 Message Date
Miss Islington (bot)
e75f528e78
[3.13] gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292) (GH-133295)
gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292)
(cherry picked from commit 2590774c9b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-05-02 18:10:32 +02:00
Miss Islington (bot)
3ff35ba471
[3.13] gh-132527: Added missing w typecode to array() error message (GH-132529) (#132938)
Co-authored-by: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-25 17:12:02 +03:00
Serhiy Storchaka
3c29fb2974
[3.13] gh-132753: Argument Clinic: Fix support of c_default for the bool converter (GH-132754) (GH-132766)
(cherry picked from commit 78cfee6f09)
2025-04-21 07:10:31 +00:00
Peter Bierma
47c8df6172
[3.13] gh-132673: Fix a crash with zero-alignment in ctypes.Structure (#132695) 2025-04-19 14:29:05 +00:00
Miss Islington (bot)
83cb89b941
[3.13] gh-129719: Restore missing socket.CAN_RAW_ERR_FILTER on Linux (GH-129721) (#132702)
gh-129719: Restore missing `socket.CAN_RAW_ERR_FILTER` on Linux (GH-129721)
(cherry picked from commit ce31ae5209)

Co-authored-by: Jeroen Bogers <11465689+jbogers@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-04-18 20:49:23 +00:00
Miss Islington (bot)
b78728210c
[3.13] gh-132674: fix _hashopenssl.c compiler warnings on free-threaded build (GH-132675) (#132677)
gh-132674: fix `_hashopenssl.c` compiler warnings on free-threaded build (GH-132675)
(cherry picked from commit 2df0f88047)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-18 12:17:36 +00:00
Miss Islington (bot)
ff3f6588c3
[3.13] gh-130052: Fix search_map_for_section() error handling (GH-132594) (#132598)
gh-130052: Fix search_map_for_section() error handling (GH-132594)

* Don't call close() if the file descriptor is negative.
* If close() fails, chain the existing exception.
(cherry picked from commit 014c7f9047)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-16 14:21:58 +00:00
Serhiy Storchaka
d321b6ec82
[3.13] gh-132099: Harmonize Bluetooth address handling (GH-132486) (GH-132497)
Now all protocols always accept the Bluetooth address as string and
getsockname() always returns the Bluetooth address as string.

* BTPROTO_SCO now accepts not only bytes, but str.
* BTPROTO_SCO now checks address for embedded null.
* On *BSD, BTPROTO_HCI now accepts str instead of bytes.
* On FreeBSD, getsockname() for BTPROTO_HCI now returns str instead of bytes.
* On NetBSD and DragonFly BSD, BTPROTO_HCI now checks address for embedded null.
(cherry picked from commit 1fc1df8dcc)
2025-04-14 19:36:04 +03:00
Serhiy Storchaka
5be7505730
[3.13] gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly BSD (GH-132431) (GH-132458)
Also fix a compiler warning on FreeBSD.
(cherry picked from commit f2f86d3f45)
2025-04-13 01:22:41 +03:00
Miss Islington (bot)
0aabe44fa8
[3.13] GH-132417: ctypes: Fix potential Py_DECREF(NULL) when handling functions returning PyObject * (GH-132418) (#132425)
GH-132417: ctypes: Fix potential `Py_DECREF(NULL)` when handling functions returning `PyObject *` (GH-132418)

Some functions (such as `PyErr_Occurred`) with a `restype` set to `ctypes.py_object` may return NULL without setting an exception.
(cherry picked from commit 2aab2db146)

Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
2025-04-12 09:14:07 +00:00
Miss Islington (bot)
88c1ca9eba
[3.13] gh-131127: Minimal build support on systems using LibreSSL (GH-131128) (GH-132392)
(cherry picked from commit 1b49c8c71b)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
2025-04-11 13:00:34 +00:00
Miss Islington (bot)
10fe658f34
[3.13] gh-132250: Clear error in lsprof callback when method descriptor raises an excep… (GH-132251) (#132281)
gh-132250: Clear error in lsprof callback when method descriptor raises an excep… (GH-132251)
(cherry picked from commit ab64130b57)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-04-08 17:19:40 -04:00
Miss Islington (bot)
ed28f2f42a
[3.13] gh-132174: Fix function name in error message of _interpreters.run_string (GH-132175) (#132209)
gh-132174: Fix function name in error message of `_interpreters.run_string` (GH-132175)
(cherry picked from commit f2daa96c81)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-04-08 10:46:13 +02:00
Miss Islington (bot)
ac9d7c6207
[3.13] gh-131809: Upgrade vendored expat to 2.7.1 (GH-132192) (#132236)
* gh-131809: Upgrade vendored expat to 2.7.1 (GH-132192)
(cherry picked from commit c0de650024)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

* make regen-sbom

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-04-07 21:24:55 +00:00
Miss Islington (bot)
6afab81f72
[3.13] gh-132171: Fix _interpreters.run_string crash on string subclass (GH-132173) (#132219)
gh-132171: Fix `_interpreters.run_string` crash on string subclass (GH-132173)
(cherry picked from commit 3980718710)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-07 12:23:02 +00:00
Miss Islington (bot)
71b537572a
[3.13] gh-122040: reword Modules/xxmodule.c module-level comment (GH-132201) (#132207)
gh-122040: reword `Modules/xxmodule.c` module-level comment (GH-132201)
(cherry picked from commit af8d1b9537)

Co-authored-by: Sonny Ding <93831983+sonnyding1@users.noreply.github.com>
2025-04-07 08:27:34 +00:00
Miss Islington (bot)
0c0ffbe39f
[3.13] gh-132075: Fix possible use of sockaddr structures with uninitialized members (GH-132076) (GH-132086)
Now all structure members are initialized with zeroes by default.
(cherry picked from commit 345baa77ba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-04 14:33:57 +00:00
Victor Stinner
c318a03b17
[3.13] gh-111178: Fix getsockaddrarg() undefined behavior (#131668) (#131977)
gh-111178: Fix getsockaddrarg() undefined behavior (#131668)

Don't pass direct references to sockaddr members since their type may
not match PyArg_ParseTuple() types. Instead, use temporary 'int' and
'unsigned char' variables, and update sockaddr members afterwards.

On FreeBSD, treat BTPROTO_HCI node name as a bytes string,
not as an integer.

(cherry picked from commit 8cd29c2b53)
2025-04-01 14:40:00 +00:00
Miss Islington (bot)
d52371c8cd
[3.13] gh-131936: Strengthen check in _suggestions._generate_suggestions (GH-131945) (#131949)
gh-131936: Strengthen check in `_suggestions._generate_suggestions` (GH-131945)
(cherry picked from commit 511d3440a0)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-03-31 17:54:20 +00:00
Miss Islington (bot)
b41c8cc671
[3.13] gh-126033: fix UAF in xml.etree.ElementTree.Element.remove when concurrent mutations happen (GH-126124) (#131929)
gh-126033: fix UAF in `xml.etree.ElementTree.Element.remove` when concurrent mutations happen (GH-126124)
(cherry picked from commit bab1398a47)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-31 14:50:03 +02:00
Bénédikt Tran
588bb6ddf4
[3.13] gh-126037: fix UAF in xml.etree.ElementTree.Element.find* when current mutations happen (#127964) (#131931)
gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when concurrent mutations happen (#127964)

We fix a use-after-free in the `find`, `findtext` and `findall` methods of `xml.etree.ElementTree.Element`
objects that can be triggered when the tag to find implements an `__eq__` method that mutates the
element being queried.

(cherry picked from commit c57623c221)
2025-03-31 14:48:42 +02:00
Steve Dower
de8bc17c33
gh-131423: Update to OpenSSL 3.0.16. (GH-131839)
The bin tag is 3.0.16.1 because we rebuilt without uplink support to fix gh-131804.
This PR also prevents making calls that are now unsafe without uplink, and updates
the tests to property interpret these failures as unsupported.
2025-03-28 16:28:11 +00:00
Miss Islington (bot)
91ae3307ee
[3.13] gh-129900: Fix SystemExit return codes when the REPL is started from the command line (GH-129901) (#131734)
gh-129900: Fix `SystemExit` return codes when the REPL is started from the command line (GH-129901)
(cherry picked from commit 90b82f2b61)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-03-25 20:15:00 +00:00
Miss Islington (bot)
4af3d0e810
[3.13] gh-131418: remove unused legacy typedefs in {md5,sha1}module.c (GH-131420) (#131620)
gh-131418: remove unused legacy typedefs in `{md5,sha1}module.c` (GH-131420)

- Remove legacy typedefs `MD5_INT32` and `MD5_INT64` in `Modules/md5module.c`
- Remove legacy typedefs `SHA1_INT32` and `SHA1_INT64` in `Modules/sha1module.c`.

Those legacy typedefs were used to detect whether the host platform could
correctly implement MD5 and SHA-1, but this is no longer needed as we now
fallback to HACL* implementations.
(cherry picked from commit a9a399f0ec)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-23 12:21:57 +00:00
Bénédikt Tran
170abd2199
[3.13] gh-127667: refactor and improve _hashopenssl.c error branches (#131145) (#131347)
gh-127667: refactor and improve `_hashopenssl.c` error branches (#131145)

Refactor `_setException()` into different helpers that can be used separately:

- set_ssl_exception_from_errcode(): set an exception from an explicit SSL error code.
- raise_ssl_error(): set an exception from the last SSL error code or use a user-defined message.
- notify_ssl_error_occurred(): same as raise_ssl_error() but with a generic default message.

(cherry-picked from commit ac50ece6ce).
2025-03-18 10:16:49 +01:00
Malcolm Smith
e8e6e30054
[3.13] gh-118201: Simplify conv_confname (#126089) (#131375)
gh-118201: Simplify conv_confname (#126089)

(cherry picked from commit c5c9286804)
2025-03-18 12:53:10 +08:00
Petr Viktorin
6af54d298d
[3.13] gh-131261: Update libexpat to 2.7.0 (CVE-2024-8176)
(cherry picked from commit bb0268f60d)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-03-17 09:44:28 -05:00
Sam Gross
5646f6f739
[3.13] gh-130382: add missing _PyReftracerTrack to ceval Py_DECREF (GH-130689) (#131195)
(cherry picked from commit c5abded099)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-03-14 09:52:05 -04:00
Miss Islington (bot)
f9d19a3ada
[3.13] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (GH-131044) (#131084)
(cherry picked from commit de8818ae23)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
2025-03-11 11:56:54 +00:00
Miss Islington (bot)
6321e1ab4b
[3.13] gh-130824: Add tests for NULL in PyLong_*AndOverflow functions (GH-130828) (GH-130869)
(cherry picked from commit 90130807d9)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-03-05 13:51:52 +02:00
Bénédikt Tran
00cf2a621a
[3.13] gh-130740: Move some stdbool.h includes after Python.h (#130738) (#130756)
gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)

Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h` (this caused some
build failures when compiling CPython with `zig cc`).

(cherry-picked from commit 214562ed4d)

---------

Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
2025-03-03 13:09:59 +01:00
Bénédikt Tran
9643ce9019
[3.13] gh-127667: fix memory leaks in hashlib (GH-127668) (#130784)
gh-127667: fix memory leaks in `hashlib` (GH-127668)

- Correctly handle `NULL` values returned by `EVP_MD_CTX_md`.
- Correctly free resources in error branches.
- Consistently suppress `_setException()` return value when needed.
- Collapse `_setException() + return NULL` into a single statement.

(cherry-picked from commit 097846502b)
2025-03-03 11:01:01 +00:00
Miss Islington (bot)
bafad85181
[3.13] gh-130617 : fix time_clockid_converter on DragonFlyBSD (GH-130634) (#130666)
gh-130617 : fix time_clockid_converter on DragonFlyBSD (GH-130634)
(cherry picked from commit e41981704f)

Signed-off-by: leleliu008 <leleliu008@gmail.com>
Co-authored-by: leleliu008 <leleliu008@gmail.com>
2025-02-28 08:19:45 +00:00
Serhiy Storchaka
2ab7e1135a
[3.13] gh-130163: Fix a leak in _pickle.c after backporting (GH-130568) 2025-02-26 12:47:41 +02:00
Serhiy Storchaka
7c1b76fce8
[3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556)
The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed
reference, has been replaced by using one of the following functions, which
return a strong reference and distinguish a missing attribute from an error:
_PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(),
_PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
(cherry picked from commit 0ef4ffeefd)
2025-02-25 22:50:26 +00:00
Miss Islington (bot)
d71b167c5c
[3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) (GH-130507)
(cherry picked from commit fc8d2cba54)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-24 16:49:35 +01:00
Miss Islington (bot)
86dab0e67e
[3.13] gh-130151: Fix reference leaks in _hashlib.hmac_{new,digest} (GH-130152) (#130491)
gh-130151: Fix reference leaks in `_hashlib.hmac_{new,digest}` (GH-130152)

* fix leak in `_hashlib.hmac_new`
* fix leak in `hmac_digest`
* fix exception type in `_hashlib.HMAC.copy`
(cherry picked from commit 071820113f)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-24 00:19:49 -08:00
Miss Islington (bot)
6cd2f356c3
[3.13] gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (GH-129839) (#130366)
gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (GH-129839)

Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
(cherry picked from commit 568db400ff)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
2025-02-20 16:30:46 +00:00
Miss Islington (bot)
5d83b6c160
[3.13] gh-130230: Fix crash in pow() with only Decimal third argument (GH-130237) (GH-130246)
(cherry picked from commit b93b7e566e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-18 13:18:37 +02:00
Miss Islington (bot)
2fcad2a47b
[3.13] gh-130179: Fix persistent_{id,load}_attr reference leaks in _pickle (GH-130180) (#130190)
gh-130179: Fix `persistent_{id,load}_attr` reference leaks in `_pickle` (GH-130180)
(cherry picked from commit e7f00cd14f)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-16 14:22:23 +00:00
Kumar Aditya
4cb251d06f
[3.13] gh-129983: fix data race in compile_template in sre.c (#130038)
gh-129983: fix data race in compile_template in sre.c (#130015)

(cherry picked from commit 3cf68cdd3e)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-02-12 13:33:56 +00:00
Erlend E. Aasland
d6daeeeb2f
[3.13] gh-129603: Don't segfault if sqlite3.Row description is None (#129604) (#129923)
(cherry picked from commit 7e6ee50b6b)
2025-02-10 00:21:33 +00:00
Tomasz Pytel
4a1389ced4
[3.13] gh-128657: fix _hashopenssl ref/data race (GH-128886) (GH-129853)
(cherry picked from commit 6c67904e79)
2025-02-08 10:59:30 -05:00
Miss Islington (bot)
506c76f1bd
[3.13] gh-129502: Fix handling errors in ctypes callbacks (GH-129504) (#129517)
gh-129502: Fix handling errors in ctypes callbacks (GH-129504)

Unlikely errors in preparing arguments for ctypes callback are now
handled in the same way as errors raised in the callback of in converting
the result of the callback -- using sys.unraisablehook() instead of
sys.excepthook() and not setting sys.last_exc and other variables.
(cherry picked from commit 9d63ae5fe5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-04 00:05:51 +00:00
Miss Islington (bot)
de27372234
[3.13] gh-129345: null check for indent syslogmodule (GH-129348) (#129442)
gh-129345: null check for indent syslogmodule (GH-129348)
(cherry picked from commit 25cf79a082)

Co-authored-by: Burkov Egor <xwooffie@gmail.com>
2025-02-04 00:37:24 +01:00
Collin Funk
65f3432ac3
[3.13] gh-129539: Include sysexits.h before checking EX_OK (#129590)
Previously, the macro would be redefined when the header was included.
2025-02-02 19:37:32 +01:00
Victor Stinner
9a59a51733
[3.13] gh-111495: Add PyFile tests (#129449) (#129477)
gh-111495: Add PyFile tests (#129449)

Add tests for the following functions in test_capi.test_file:

* PyFile_FromFd()
* PyFile_GetLine()
* PyFile_NewStdPrinter()
* PyFile_WriteObject()
* PyFile_WriteString()
* PyObject_AsFileDescriptor()

Add Modules/_testlimitedcapi/file.c file.

Remove test_embed.StdPrinterTests which became redundant.

(cherry picked from commit 4ca9fc08f8)
2025-01-30 20:29:27 +01:00
Miss Islington (bot)
48b87d14e8
[3.13] gh-129409: Fix Integer overflow - SEGV while writing data more than 2GB in CSV file (GH-129413) (#129436)
gh-129409: Fix Integer overflow -  SEGV while writing data more than 2GB in CSV file (GH-129413)
(cherry picked from commit 97b0ef05d9)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
2025-01-29 11:39:16 +00:00
Miss Islington (bot)
247c3b2644
[3.13] gh-129346: Handle allocation errors for SQLite aggregate context (GH-129347) (#129372)
(cherry picked from commit 379ab856f5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-27 17:41:59 +00:00
Victor Stinner
e3b3e01d6a
[3.13] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217)
gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191)

Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack()
during late Python finalization.

* Call _PyTraceMalloc_Fini() later in Python finalization.
* Test also PyTraceMalloc_Untrack() without the GIL
* PyTraceMalloc_Untrack() now gets the GIL.
* Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race().

(cherry picked from commit 46c7e13c05)
2025-01-23 13:59:19 +01:00