summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-129502: Fix handling errors in ctypes callbacks (GH-129504) (#129517)Miss Islington (bot)2025-02-041-36/+30
| | | | | | | | | | | | 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 9d63ae5fe52d95059ab1bcd4cbb1f9e17033c897) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-129345: null check for indent syslogmodule (GH-129348) (#129442)Miss Islington (bot)2025-02-031-1/+1
| | | | | | gh-129345: null check for indent syslogmodule (GH-129348) (cherry picked from commit 25cf79a0829422bd8479ca0c13c72b769422077b) Co-authored-by: Burkov Egor <xwooffie@gmail.com>
* [3.13] gh-129539: Include sysexits.h before checking EX_OK (#129590)Collin Funk2025-02-021-4/+4
| | | Previously, the macro would be redefined when the header was included.
* [3.13] gh-111495: Add PyFile tests (#129449) (#129477)Victor Stinner2025-01-307-6/+270
| | | | | | | | | | | | | | | | | | 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 4ca9fc08f89bf7172d41e523d9e520eb1729ee8c)
* [3.13] gh-129409: Fix Integer overflow - SEGV while writing data more than ↵Miss Islington (bot)2025-01-291-1/+1
| | | | | | | | 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 97b0ef05d987ebef354512b516a246feb411e815) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
* [3.13] gh-129346: Handle allocation errors for SQLite aggregate context ↵Miss Islington (bot)2025-01-271-0/+5
| | | | | | | (GH-129347) (#129372) (cherry picked from commit 379ab856f59423c570333403a7d5d72f3ea82d52) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.13] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217)Victor Stinner2025-01-232-2/+12
| | | | | | | | | | | | | 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 46c7e13c055c218e18b0424efc60965e6a5fe6ea)
* [3.13] gh-111178: fix UBSan failures in ↵Miss Islington (bot)2025-01-201-2/+5
| | | | | | | | | | `Modules/_multiprocessing/semaphore.c` (GH-129084) (#129100) gh-111178: fix UBSan failures in `Modules/_multiprocessing/semaphore.c` (GH-129084) fix UBSan failures for `SemLockObject` (cherry picked from commit 5ed5572cac7ef204767ddf8e8888e15672ba558e) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] Fix a typo in `syslog`'s error message (GH-129029) (#129049)Miss Islington (bot)2025-01-201-1/+1
| | | | | | Fix a typo in `syslog`'s error message (GH-129029) (cherry picked from commit 9b1c1817af30e609b7cbfacbe5b1e73e21dc9e37) Co-authored-by: Tomas R <tomas.roun8@gmail.com>
* [3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897)Victor Stinner2025-01-182-5/+99
| | | | | | | | | | | | | tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(), PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check tracemalloc_config.tracing after calling TABLES_LOCK(). _PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(), especially setting tracemalloc_config.tracing to 1. Add a test using PyTraceMalloc_Track() to test tracemalloc.stop() race condition. Call _PyTraceMalloc_Init() at Python startup.
* [3.13] gh-111495: Add more tests on PyEval C APIs (#122789) (#128987)Victor Stinner2025-01-185-22/+100
| | | | | | | | | | | | * gh-111495: Add more tests on PyEval C APIs (#122789) * Add Lib/test/test_capi/test_eval.py * Add Modules/_testlimitedcapi/eval.c (cherry picked from commit bf8b3746398ea756c97e3cf263d63ca3ce3a544e) * gh-111495: Fix refleaks in test_capi.test_eval tests (#122851) (cherry picked from commit b4a316087c32d83e375087fd35fc511bc430ee8b)
* [3.13] gh-128961: Fix exhausted array iterator crash in __setstate__() ↵Miss Islington (bot)2025-01-181-5/+10
| | | | | | | (GH-128962) (#128976) (cherry picked from commit 4dade055f4e18a7e91bc70293abb4db745ad16ca) Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
* [3.13] gh-128911: Add tests on the PyImport C API (#128915) (#128960)Victor Stinner2025-01-175-48/+311
| | | | | | | | | | | gh-128911: Add tests on the PyImport C API (#128915) * Add Modules/_testlimitedcapi/import.c * Add Lib/test/test_capi/test_import.py * Remove _testcapi.check_pyimport_addmodule(): tests already covered by newly added tests. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit d95ba9fa1110534b7247fa2ff12b90e930c93256)
* [3.13] gh-58689: Fix os.kill() error handling on Windows (GH-128932) (#128937)Miss Islington (bot)2025-01-171-18/+9
| | | | | | gh-58689: Fix os.kill() error handling on Windows (GH-128932) (cherry picked from commit 939df0f9f6a76e0916b3ba53841e1413ab90952e) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-127614: Correctly check for ttyname_r() in configure (#128503) ↵Erlend E. Aasland2025-01-112-4/+4
| | | | | | | | (#128598) (cherry picked from commit e08b28235a863323ca3a7e444776bb7803e77caf) PR #14868 replaced the ttyname() call with ttyname_r(), but the old check remained.
* [3.13] gh-127196: Fix crash in `_interpreters`, when `shared` had invalid ↵Miss Islington (bot)2025-01-091-1/+6
| | | | | | | | encodings (GH-127220) (#128689) gh-127196: Fix crash in `_interpreters`, when `shared` had invalid encodings (GH-127220) (cherry picked from commit 087bb48acac997c06e69dae25bae2dd75194b980) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-128400: Stop-the-world when manually calling `faulthandler` ↵Miss Islington (bot)2025-01-021-0/+5
| | | | | | | (GH-128422) (GH-128423) (cherry picked from commit c9356feef28e6dfc4dc32830d3427a5ae0e426e2) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-123925: Fix building curses on platforms without libncursesw ↵Miss Islington (bot)2025-01-021-1/+1
| | | | | | | (GH-128405) (GH-128407) (cherry picked from commit 8d16919a06a55a50756bf083221a6f6cab43de50) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-128217: Validate the normalized_environment variable instead of the ↵Miss Islington (bot)2024-12-241-1/+1
| | | | | | | similarly named function (GH-128220) (cherry picked from commit 3ddd70ceaaf67b111ee4251817e150396d6d10a9) Co-authored-by: Sergey Muraviov <smurav@mail.ru>
* [3.13] gh-128083: Fix macro redefinition warning in clinic. (GH-127950) ↵Peter Bierma2024-12-192-2/+59
| | | | | | | (#128102) (cherry picked from commit b5d1e4552f0ba40d8380368e1b099261686a89cf) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror ↵Miss Islington (bot)2024-12-178-53/+68
| | | | | | | | | | messages (GH-126746) (GH-128023) - Add a helper to set an error from locale-encoded `char*` - Use the helper for gdbm & dlerror messages (cherry picked from commit 7303f06846b69016a075bca7ad7c6055f29ad024) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-127870: Detect recursive calls in ctypes _as_parameter_ handling ↵Miss Islington (bot)2024-12-131-1/+21
| | | | | | | | (GH-127872) (#127917) gh-127870: Detect recursive calls in ctypes _as_parameter_ handling (GH-127872) (cherry picked from commit 6ff38fc4e2af8e795dc791be6ea596d2146d4119) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361) (GH-127812)Miss Islington (bot)2024-12-121-0/+10
| | | | | | | | | | | | | | | | | | | gh-127257: ssl: Raise OSError for ERR_LIB_SYS (GH-127361) From the ERR_raise manpage: ERR_LIB_SYS This "library code" indicates that a system error is being reported. In this case, the reason code given to `ERR_raise()` and `ERR_raise_data()` *must* be `errno(3)`. This PR only handles ERR_LIB_SYS for the high-lever error types SSL_ERROR_SYSCALL and SSL_ERROR_SSL, i.e., not the ones where OpenSSL indicates it has some more information about the issue. (cherry picked from commit f4b31edf2d9d72878dab1f66a36913b5bcc848ec) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-127791: Fix, document, and test `PyUnstable_AtExit` (GH-127793) ↵Peter Bierma2024-12-113-38/+57
| | | | | | | | | | (#127819) * Fix merge conflicts. * [3.13] gh-127791: Fix, document, and test `PyUnstable_AtExit` (GH-127793) (cherry picked from commit d5d84c3f13fe7fe591b375c41979d362bc11957a) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-122431: Disallow negative values in `readline.append_history_file` ↵Miss Islington (bot)2024-12-051-0/+6
| | | | | | | | | (GH-122469) (#127641) gh-122431: Disallow negative values in `readline.append_history_file` (GH-122469) (cherry picked from commit 208b0fb645c0e14b0826c0014e74a0b70c58c9d6) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (GH-127593) ↵Miss Islington (bot)2024-12-051-0/+3
| | | | | | | | (#127630) gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (GH-127593) (cherry picked from commit fcbe6ecdb6ed4dd93b2ee144f89a73af755e2634) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126876: Fix socket internal_select() for large timeout (GH-126968) ↵Miss Islington (bot)2024-12-021-1/+4
| | | | | | | | | | | | | (#127002) gh-126876: Fix socket internal_select() for large timeout (GH-126968) If the timeout is larger than INT_MAX, replace it with INT_MAX, in the poll() code path. Add an unit test. (cherry picked from commit b3687ad454c4ac54c8599a10f3ace8a13ca48915) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126890: Restore stripped `ssl` docstrings (GH-127281) (#127513)Peter Bierma2024-12-022-125/+153
| | | | | (cherry picked from commit c112de1da2d18e3b5c2ea30b0e409f18e574efd8) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
* [3.13] gh-124984: Enhance `ssl` thread safety (GH-124993) (#125780)Peter Bierma2024-12-022-243/+1643
| | | | | | | | | Make SSL objects thread safe in Free Theaded build by using critical sections. (cherry picked from commit 4c53b2577531c77193430cdcd66ad6385fcda81f) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127508)Miss Islington (bot)2024-12-021-6/+3
| | | | | | | gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (cherry picked from commit 930ba0ce605eee9e3b992fa368b00a3f2b7dc4c1) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-127190: Fix local_setattro() error handling (GH-127366) (#127367)Miss Islington (bot)2024-12-011-1/+1
| | | | | | | | | gh-127190: Fix local_setattro() error handling (GH-127366) Don't make the assumption that the 'name' argument is a string. Use repr() to format the 'name' argument instead. (cherry picked from commit 20657fbdb14d50ca4ec115da0cbef155871d8d33) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-127341: Argument Clinic: fix compiler warnings for getters with ↵Peter Bierma2024-11-303-51/+21
| | | | | | | docstrings (GH-127310) (#127431) (cherry picked from commit 99490913a08adcf2fe5e69b82772a829ec462275) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.13] gh-124008: Fix calculation of the number of written bytes for the ↵Miss Islington (bot)2024-11-301-28/+90
| | | | | | | | | | | | | | | Windows console (GH-124059) (GH-127325) Since MultiByteToWideChar()/WideCharToMultiByte() is not reversible if the data contains invalid UTF-8 sequences, use binary search to calculate the number of written bytes from the number of written characters. Also fix writing incomplete UTF-8 sequences. Also fix handling of memory allocation failures. (cherry picked from commit 3cf83d91a5baf3600dd60f7aaaf4fb6d73c4b8a9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055) ↵Victor Stinner2024-11-262-59/+79
| | | | | | | | | | | | | | | | (#127104) * gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055) grpmodule.c is no longer built with the limited C API, since PyMutex is excluded from the limited C API. (cherry picked from commit 3c2bd66e21bd8de69a89ebf09ff9d8e78ddfb839) * Revert ABI changes Don't use Argument Clinic for grp.getgrgid() to avoid changing the ABI (change PyInterpreterState structure by adding an "id" identifier).
* [3.13] gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the ↵Miss Islington (bot)2024-11-251-14/+16
| | | | | | | | | first value (GH-127219) (#127262) gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219) (cherry picked from commit a2ee89968299fc4f0da4b5a4165025b941213ba5) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-109746: Make _thread.start_new_thread delete state of new thread ↵Serhiy Storchaka2024-11-221-0/+1
| | | | | | | | | | | | on its startup failure (GH-109761) (GH-127171) If Python fails to start newly created thread due to failure of underlying PyThread_start_new_thread() call, its state should be removed from interpreter' thread states list to avoid its double cleanup. (cherry picked from commit ca3ea9ad05c3d876a58463595e5b4228fda06936) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
* [3.13] gh-127065: Make `methodcaller` thread-safe in free threading build ↵Miss Islington (bot)2024-11-221-0/+9
| | | | | | | | | | | | (GH-127109) (GH-127150) The `methodcaller` C vectorcall implementation uses an arguments array that is shared across calls. The first argument is modified on every invocation. This isn't thread-safe in the free threading build. I think it's also not safe in general, but for now just disable it in the free threading build. (cherry picked from commit f83ca6962af973fff6a3124f4bd3d45fea4dd5b8) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127097)Serhiy Storchaka2024-11-211-24/+41
| | | | | It now returns multiple era description segments separated by semicolons. Previously it only returned the first segment on platforms with Glibc. (cherry picked from commit 4803cd0244847f286641c85591fda08b513cea52)
* [3.13] gh-126991: Fix reference leak in loading pickle's opcode BUILD ↵Miss Islington (bot)2024-11-191-0/+1
| | | | | | | | (GH-126990) (GH-127018) If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable. (cherry picked from commit 29cbcbd73bbfd8c953c0b213fb33682c289934ff) Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
* [3.13] gh-101955: Fix SystemError in possesive quantifier with alternative ↵Miss Islington (bot)2024-11-181-0/+18
| | | | | | | and group (GH-111362) (GH-126962) (cherry picked from commit f9c5573dedcb2f2e9ae152672ce157987cdea612) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-67877: Fix memory leaks in terminated RE matching (GH-126840) ↵Serhiy Storchaka2024-11-184-14/+205
| | | | | | | | | | (GH-126960) If SRE(match) function terminates abruptly, either because of a signal or because memory allocation fails, allocated SRE_REPEAT blocks might be never released. Co-authored-by: <wjssz@users.noreply.github.com> (cherry picked from commit 7538e7f5696408fa0aa02fce8a413a7dfac76a04)
* [3.13] gh-126554: ctypes: Correctly handle NULL dlsym values (GH-126555) ↵Miss Islington (bot)2024-11-172-31/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#126861) For dlsym(), a return value of NULL does not necessarily indicate an error [1]. Therefore, to avoid using stale (or NULL) dlerror() values, we must: 1. clear the previous error state by calling dlerror() 2. call dlsym() 3. call dlerror() If the return value of dlerror() is not NULL, an error occured. In ctypes we choose to treat a NULL return value from dlsym() as a "not found" error. This is the same as the fallback message we use on Windows, Cygwin or when getting/formatting the error reason fails. [1]: https://man7.org/linux/man-pages/man3/dlsym.3.html (cherry picked from commit 8717f792f7cc343599dc60daf80630cceb66145b) Signed-off-by: Georgios Alexopoulos <grgalex@ba.uoa.gr> Co-authored-by: George Alexopoulos <giorgosalexo0@gmail.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-126433: Fix compiler warnings on 32-bit Windows (#126444) (#126827)Victor Stinner2024-11-143-6/+8
| | | | | gh-126433: Fix compiler warnings on 32-bit Windows (#126444) (cherry picked from commit 0b67ce930a56c4ffd597b1a658ddcbacfb40e798)
* [3.13] gh-126433: Change channel_info.count to int64_t (GH-126447) (#126826)Miss Islington (bot)2024-11-141-1/+1
| | | | | | | | | gh-126433: Change channel_info.count to int64_t (GH-126447) Fix compiler warnings on 32-bit Windows: change channel_info.count type from Py_ssize_t to int64_t in _interpchannelsmodule.c. (cherry picked from commit 09d7083962062acfef7e7a9a309a01fb70ad8276) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126623: Update libexpat to 2.6.4, make future updates easier ↵Miss Islington (bot)2024-11-134-11/+79
| | | | | | | | | | (GH-126792) (GH-126796) gh-126623: Update libexpat to 2.6.4, make future updates easier (GH-126792) Update libexpat to 2.6.4, make future updates easier. (cherry picked from commit 3c9996909402fadc98e6ca2a64e75a71a7427352) Co-authored-by: Seth Michael Larson <seth@python.org>
* [3.13] gh-126688: Reinit import lock after fork (GH-126692) (GH-126765)Miss Islington (bot)2024-11-121-0/+1
| | | | | | | | | The PyMutex implementation supports unlocking after fork because we clear the list of waiters in parking_lot.c. This doesn't work as well for _PyRecursiveMutex because on some systems, such as SerenityOS, the thread id is not preserved across fork(). (cherry picked from commit 5610860840aa71b186fc5639211dd268b817d65f) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` ↵Miss Islington (bot)2024-11-121-0/+3
| | | | | | | | (GH-126617) (#126739) gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617) (cherry picked from commit 6e3bb8a91380ba98d704f2dca8e98923c0abc8a8) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-126405: fix use-after-free in ↵Miss Islington (bot)2024-11-121-0/+2
| | | | | | | | `_asyncio.Future.remove_done_callback` (GH-126733) (#126736) gh-126405: fix use-after-free in `_asyncio.Future.remove_done_callback` (GH-126733) (cherry picked from commit 37c57dfad12744608091653fd753a1f770e2479b) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* [3.13] gh-126654: Fix crash in several functions in `_interpreters` module ↵Miss Islington (bot)2024-11-111-0/+5
| | | | | | | | (GH-126678) (#126681) gh-126654: Fix crash in several functions in `_interpreters` module (GH-126678) (cherry picked from commit 9fc2808eaf4e74a9f52f44d20a7d1110bd949d41) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-125631: Enable setting persistent_id and persistent_load of ↵Miss Islington (bot)2024-11-071-0/+62
| | | | | | | | | pickler and unpickler (GH-125752) (GH-126528) pickle.Pickler.persistent_id and pickle.Unpickler.persistent_load can again be overridden as instance attributes. (cherry picked from commit 223d3dc554dde45f185f7f465753824c6f698b9b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>