summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-133489: Remove size restrictions on getrandbits() and randbytes() ↵Serhiy Storchaka2025-06-022-16/+14
| | | | | | | (GH-133658) (GH-134965) random.getrandbits() can now generate more that 2**31 bits. random.randbytes() can now generate more that 256 MiB. (cherry picked from commit 68784fed78aa297f0de0d038742495709185bef5)
* [3.13] gh-134908: Protect `textiowrapper_iternext` with critical section ↵Sam Gross2025-06-021-1/+15
| | | | | | | | | (gh-134910) (gh-135040) The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not use a critical section, making it racy in free-threaded builds. (cherry picked from commit 44fb7c361cb24dcf9989a7a1cfee4f6aad5c81aa) Co-authored-by: Duane Griffin <duaneg@dghda.com>
* [3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors ↵Bénédikt Tran2025-06-0115-426/+783
| | | | | | | | | | AC signatures (GH-134713) (#134962) OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters. Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`, while the documentation expected `data` to be given in all cases. (cherry picked from commit c6e63d9d351f6d952000ec3bf84b3a7607989f92) (cherry picked from commit 379d0bc95646dfe923e7ea05fb7f1befbd85572d)
* [3.13] gh-134210: handle signals in `_curses.window.getch` (GH-134326) (#134784)Bénédikt Tran2025-05-272-12/+17
| | | (cherry picked from commit 51762b6cadb8f316dd783716bc5c168c2e2d07f0)
* [3.13] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134685)Sergey B Kirpichev2025-05-261-0/+21
| | | | | | | | | * gh-132876: workaround broken ldexp() on Windows 10 ldexp() fails to round subnormal results before Windows 11, so hide their bug. (cherry picked from commit cf8941c60356acdd00055e5583a2d64761c34af4) Co-authored-by: Tim Peters <tim.peters@gmail.com>
* [3.13] gh-134381: Fix RuntimeError when starting not-yet started Thread ↵Miss Islington (bot)2025-05-231-0/+6
| | | | | | | after fork (gh-134514) (gh-134597) (cherry picked from commit 9a2346df861f26d5f8d054ad2f9c37134dee3822) Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
* [3.13] gh-133904: Fix `math.factorial` documentation (GH-133907) (#133922)mkaraev2025-05-122-7/+3
| | | | | | | * [3.13] gh-133904: Fix `math.factorial` documentation (GH-133907) (cherry picked from commit 27ed64575d34f04029ba1d353810f3db4f4f045b) Co-authored-by: mkaraev <maruf.karaev97@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-133009: fix UAF in `xml.etree.ElementTree.Element.__deepcopy__` ↵Miss Islington (bot)2025-05-101-7/+34
| | | | | | | | (GH-133010) (#133806) gh-133009: fix UAF in `xml.etree.ElementTree.Element.__deepcopy__` (GH-133010) (cherry picked from commit 116a9f9b3775c904c98e390d896200e1641498aa) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-122559: Synchronize C and Python implementation of the io module ↵Serhiy Storchaka2025-05-043-10/+5
| | | | | | | | | | | about pickling (GH-122628) (GH-133381) In the C implementation, remove __reduce__ and __reduce_ex__ methods that always raise TypeError and restore __getstate__ methods that always raise TypeErrori. This restores fine details of the pre-3.12 behavior and unifies both implementations. (cherry picked from commit e9253ebf74433de5ae6d7f1bce693a3a1173b3b1)
* [3.13] bpo-44172: Keep reference to original window in curses subwindow ↵Serhiy Storchaka2025-05-041-8/+12
| | | | | | | | | | | | | | | | | | | objects (GH-26226) (GH-133370) The X/Open curses specification[0] and ncurses documentation[1] both state that subwindows must be deleted before the main window. Deleting the windows in the wrong order causes a double-free with NetBSD's curses implementation. To fix this, keep track of the original window object in the subwindow object, and keep a reference to the original for the lifetime of the subwindow. [0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html [1] https://invisible-island.net/ncurses/man/curs_window.3x.html (cherry picked from commit 0af61fe2f41048d66b0a973bbff056690446d3df) Co-authored-by: Michael Forney <mforney@mforney.org>
* [3.13] gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292) (GH-133295)Miss Islington (bot)2025-05-021-11/+1
| | | | | | gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292) (cherry picked from commit 2590774c9bb96ec75ca8a13b0c061fcc9db3eb65) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-132527: Added missing `w` typecode to array() error message ↵Miss Islington (bot)2025-04-251-1/+1
| | | | | | | | (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>
* [3.13] gh-132753: Argument Clinic: Fix support of c_default for the bool ↵Serhiy Storchaka2025-04-212-1/+79
| | | | | converter (GH-132754) (GH-132766) (cherry picked from commit 78cfee6f0920ac914ed179c013f61c53ede16fa9)
* [3.13] gh-132673: Fix a crash with zero-alignment in `ctypes.Structure` ↵Peter Bierma2025-04-191-1/+2
| | | | (#132695)
* [3.13] gh-129719: Restore missing `socket.CAN_RAW_ERR_FILTER` on Linux ↵Miss Islington (bot)2025-04-181-1/+1
| | | | | | | | | | (GH-129721) (#132702) gh-129719: Restore missing `socket.CAN_RAW_ERR_FILTER` on Linux (GH-129721) (cherry picked from commit ce31ae5209c976d28d1c21fcbb06c0ae5e50a896) 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>
* [3.13] gh-132674: fix `_hashopenssl.c` compiler warnings on free-threaded ↵Miss Islington (bot)2025-04-181-2/+2
| | | | | | | | build (GH-132675) (#132677) gh-132674: fix `_hashopenssl.c` compiler warnings on free-threaded build (GH-132675) (cherry picked from commit 2df0f8804701cc17674e5b4e90499e9fac71d0e1) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-130052: Fix search_map_for_section() error handling (GH-132594) ↵Miss Islington (bot)2025-04-161-1/+3
| | | | | | | | | | | (#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 014c7f90478780b18d0e33d456483178c8dcc665) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-132099: Harmonize Bluetooth address handling (GH-132486) (GH-132497)Serhiy Storchaka2025-04-141-22/+21
| | | | | | | | | | | 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 1fc1df8dcc7a853b0649bc8df37cd07cbd2b6230)
* [3.13] gh-132429: Fix support of Bluetooth sockets on NetBSD and DragonFly ↵Serhiy Storchaka2025-04-122-67/+77
| | | | | | BSD (GH-132431) (GH-132458) Also fix a compiler warning on FreeBSD. (cherry picked from commit f2f86d3f459a89273ea22389bb57eed402908302)
* [3.13] GH-132417: ctypes: Fix potential `Py_DECREF(NULL)` when handling ↵Miss Islington (bot)2025-04-121-3/+4
| | | | | | | | | | 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 2aab2db1461ef49b42549255af16a74b1bf8a5ef) Co-authored-by: Nicolas Trangez <ikke@nicolast.be>
* [3.13] gh-131127: Minimal build support on systems using LibreSSL ↵Miss Islington (bot)2025-04-111-1/+1
| | | | | | | (GH-131128) (GH-132392) (cherry picked from commit 1b49c8c71b90bfa97df5633e2bbf51d4a6e22a57) Co-authored-by: Collin Funk <collin.funk1@gmail.com>
* [3.13] gh-132250: Clear error in lsprof callback when method descriptor ↵Miss Islington (bot)2025-04-081-0/+1
| | | | | | | | 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 ab64130b572424695bf072f7608a536997dce14f) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
* [3.13] gh-132174: Fix function name in error message of ↵Miss Islington (bot)2025-04-081-1/+1
| | | | | | | | | `_interpreters.run_string` (GH-132175) (#132209) gh-132174: Fix function name in error message of `_interpreters.run_string` (GH-132175) (cherry picked from commit f2daa96c81a45b26bdcf3d5c3887cec02137974e) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
* [3.13] gh-131809: Upgrade vendored expat to 2.7.1 (GH-132192) (#132236)Miss Islington (bot)2025-04-074-10/+19
| | | | | | | | | | | | * gh-131809: Upgrade vendored expat to 2.7.1 (GH-132192) (cherry picked from commit c0de6500249469e6fc5b458d6afb6bad1b6755cd) Co-authored-by: Gregory P. Smith <greg@krypto.org> * make regen-sbom --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.13] gh-132171: Fix `_interpreters.run_string` crash on string subclass ↵Miss Islington (bot)2025-04-071-1/+1
| | | | | | | | (GH-132173) (#132219) gh-132171: Fix `_interpreters.run_string` crash on string subclass (GH-132173) (cherry picked from commit 398071871066548954f4c51e8250d13b7c9659e0) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-122040: reword `Modules/xxmodule.c` module-level comment ↵Miss Islington (bot)2025-04-071-2/+1
| | | | | | | | (GH-132201) (#132207) gh-122040: reword `Modules/xxmodule.c` module-level comment (GH-132201) (cherry picked from commit af8d1b95377917036aaedf18b9cc047d8877259c) Co-authored-by: Sonny Ding <93831983+sonnyding1@users.noreply.github.com>
* [3.13] gh-132075: Fix possible use of sockaddr structures with uninitialized ↵Miss Islington (bot)2025-04-041-0/+13
| | | | | | | | members (GH-132076) (GH-132086) Now all structure members are initialized with zeroes by default. (cherry picked from commit 345baa77ba2ce3b8ea8f2fad84754e5cc0b10938) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-111178: Fix getsockaddrarg() undefined behavior (#131668) (#131977)Victor Stinner2025-04-011-11/+49
| | | | | | | | | | | | 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 8cd29c2b533e5a1a262238695d05f2a7c44d6455)
* [3.13] gh-131936: Strengthen check in `_suggestions._generate_suggestions` ↵Miss Islington (bot)2025-03-311-1/+1
| | | | | | | | (GH-131945) (#131949) gh-131936: Strengthen check in `_suggestions._generate_suggestions` (GH-131945) (cherry picked from commit 511d3440a0bbb19731f4d96dde65dffbf85cdda5) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-126033: fix UAF in `xml.etree.ElementTree.Element.remove` when ↵Miss Islington (bot)2025-03-311-26/+32
| | | | | | | | 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 bab1398a47f6d0cfc1be70497f306874c749ef7c) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-126037: fix UAF in `xml.etree.ElementTree.Element.find*` when ↵Bénédikt Tran2025-03-311-37/+29
| | | | | | | | | | | 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 c57623c221d46daeaedfbf2b32d041fde0c882de)
* gh-131423: Update to OpenSSL 3.0.16. (GH-131839)Steve Dower2025-03-282-0/+13
| | | | | 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.
* [3.13] gh-129900: Fix `SystemExit` return codes when the REPL is started ↵Miss Islington (bot)2025-03-251-2/+1
| | | | | | | | 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 90b82f2b61219c8f94e2deddc989a4c4fe9ea7c7) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-131418: remove unused legacy typedefs in `{md5,sha1}module.c` ↵Miss Islington (bot)2025-03-232-18/+0
| | | | | | | | | | | | | | | (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 a9a399f0ecfeeff91425cc089057f1b95799853b) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-127667: refactor and improve `_hashopenssl.c` error branches ↵Bénédikt Tran2025-03-181-70/+111
| | | | | | | | | | | | | (#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 ac50ece6cea8745834e4ec0a9617809a51245bfc).
* [3.13] gh-118201: Simplify conv_confname (#126089) (#131375)Malcolm Smith2025-03-182-105/+52
| | | | | gh-118201: Simplify conv_confname (#126089) (cherry picked from commit c5c9286804e38c95fe717f22ce1bf2f18eee5b17)
* [3.13] gh-131261: Update libexpat to 2.7.0 (CVE-2024-8176)Petr Viktorin2025-03-173-160/+424
| | | | | (cherry picked from commit bb0268f60dfe903a9bdb8d84104247a9318c6b18) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.13] gh-130382: add missing `_PyReftracerTrack` to ceval `Py_DECREF` ↵Sam Gross2025-03-141-0/+26
| | | | | | | (GH-130689) (#131195) (cherry picked from commit c5abded09995f208b21ebaf012185ca5acb0180b) Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
* [3.13] gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (GH-131044) ↵Miss Islington (bot)2025-03-112-2/+4
| | | | | | | (#131084) (cherry picked from commit de8818ae233b8e7722aa5d6f91d4b5a04bd039df) Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
* [3.13] gh-130824: Add tests for `NULL` in `PyLong_*AndOverflow` functions ↵Miss Islington (bot)2025-03-051-2/+2
| | | | | | | | | (GH-130828) (GH-130869) (cherry picked from commit 90130807d9c5a55b2a64024f5dfbee4785b9a27c) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.13] gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738) ↵Bénédikt Tran2025-03-033-3/+5
| | | | | | | | | | | | | | | | (#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 214562ed4ddc248b007f718ed92ebcc0c3669611) --------- Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
* [3.13] gh-127667: fix memory leaks in `hashlib` (GH-127668) (#130784)Bénédikt Tran2025-03-031-56/+78
| | | | | | | | | | 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 097846502b7f33cb327d512e2a396acf4f4de46e)
* [3.13] gh-130617 : fix time_clockid_converter on DragonFlyBSD (GH-130634) ↵Miss Islington (bot)2025-02-281-0/+2
| | | | | | | | | (#130666) gh-130617 : fix time_clockid_converter on DragonFlyBSD (GH-130634) (cherry picked from commit e41981704f0a6adb58c3e258b4226619521ce03c) Signed-off-by: leleliu008 <leleliu008@gmail.com> Co-authored-by: leleliu008 <leleliu008@gmail.com>
* [3.13] gh-130163: Fix a leak in _pickle.c after backporting (GH-130568)Serhiy Storchaka2025-02-261-0/+7
|
* [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) ↵Serhiy Storchaka2025-02-256-36/+72
| | | | | | | | | | (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 0ef4ffeefd1737c18dc9326133c7894d58108c2e)
* [3.13] gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add ↵Miss Islington (bot)2025-02-241-0/+18
| | | | | | | test (GH-129406) (GH-130507) (cherry picked from commit fc8d2cba541f378df0a439412665f3dbe0b9ae3c) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-130151: Fix reference leaks in `_hashlib.hmac_{new,digest}` ↵Miss Islington (bot)2025-02-241-18/+18
| | | | | | | | | | | | (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 071820113f11b8f6a21f98652d0840e10268114c) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (GH-129839) (#130366)Miss Islington (bot)2025-02-201-4/+5
| | | | | | | | | | 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 568db400ff07240a5ed6f263af281405ccaec716) Co-authored-by: Collin Funk <collin.funk1@gmail.com>
* [3.13] gh-130230: Fix crash in pow() with only Decimal third argument ↵Miss Islington (bot)2025-02-181-1/+10
| | | | | | | | (GH-130237) (GH-130246) (cherry picked from commit b93b7e566e5a4efe7f077af2083140e50bd2b08f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-130179: Fix `persistent_{id,load}_attr` reference leaks in ↵Miss Islington (bot)2025-02-161-0/+4
| | | | | | | | | `_pickle` (GH-130180) (#130190) gh-130179: Fix `persistent_{id,load}_attr` reference leaks in `_pickle` (GH-130180) (cherry picked from commit e7f00cd14f6a0c0dee6e733ac3e2c5d92e0809bb) Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>