summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [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>
* [3.13] gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) ↵Miss Islington (bot)2024-11-061-0/+4
| | | | | | | | | | (#126495) gh-126461: Fix _Unpickler_ReadFromFile() error handling (GH-126485) Handle _Unpickler_SetStringInput() failure. (cherry picked from commit a1c57bcfd2bcbc55ff858407e09c1d8d8cee44e6) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126313: Fix a crash in curses.napms() due to incorrect error ↵Bénédikt Tran2024-11-061-1/+4
| | | | | handling (GH-126351) (#126493) gh-126313: Fix a crash in curses.napms() due to incorrect error handling (GH-126351)
* [3.13] gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) (#126486)Miss Islington (bot)2024-11-061-1/+1
| | | | | | | | | gh-126455: Disallow _ssl.SSLSocket instantiation (GH-126481) Prevent creation of incomplete/invalid _ssl.SSLSocket objects when created directly. (cherry picked from commit b1c4ffc20573befb4db66bbbdd569b9bd13bb127) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-126425: Refactor `_lsprof_Profiler_enable` (GH-126426) (#126442)Miss Islington (bot)2024-11-051-12/+25
| | | | | | | | | gh-126425: Refactor `_lsprof_Profiler_enable` (GH-126426) - Explicit memory management for `None` objects (since we still try to treat immortal objects as regular objects) - Respect possible errors of `sys.monitoring.register_callback` call (cherry picked from commit 75872605aa78dbdfc5c4f025b0f90a7f37ba10c3) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-126303: Fix pickling and copying of os.sched_param objects ↵Miss Islington (bot)2024-11-051-0/+17
| | | | | | | (GH-126336) (GH-126423) (cherry picked from commit d3840503b0f590ee574fbdf3c96626ff8b3c45f6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-126138: Fix use-after-free in `_asyncio.Task` by evil ↵Miss Islington (bot)2024-11-021-2/+20
| | | | | | | | | `__getattribute__` (GH-126305) (#126324) gh-126138: Fix use-after-free in `_asyncio.Task` by evil `__getattribute__` (GH-126305) (cherry picked from commit f032f6ba8fec6fab35edeec0eb40cd73e9d58928) Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* [3.13] gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 ↵Miss Islington (bot)2024-11-011-0/+24
| | | | | | | | | args (backportable) (GH-126271) (#126310) gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (GH-126271) (cherry picked from commit 28b148fb32e4548b461137d18d1ab6d366395d36) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.13] gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` ↵Miss Islington (bot)2024-10-311-1/+5
| | | | | | | | due to an evil `loop.__getattribute__` (GH-126120) (#126250) gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (GH-126120) (cherry picked from commit 0e8665554b2f1334e530fd6de5b3a4e908405419) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-126223: Propagate unicode errors in `_interpreters.create()` ↵Miss Islington (bot)2024-10-311-1/+5
| | | | | | | | | | (GH-126224) (#126242) gh-126223: Propagate unicode errors in `_interpreters.create()` (GH-126224) (cherry picked from commit 01415213d72504eafc159721a8f55d57b374fd9c) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing ↵Miss Islington (bot)2024-10-311-1/+1
| | | | | | | | with new non-`None` context (GH-126103) (#126229) gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (GH-126103) (cherry picked from commit d07dcce6935364cab807e0df931ed09b088ade69) Co-authored-by: Nico-Posada <102486290+Nico-Posada@users.noreply.github.com>
* [3.13] gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` ↵Miss Islington (bot)2024-10-291-3/+3
| | | | | | | | | (GH-126111) (#126116) gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` (GH-126111) (cherry picked from commit a64a1c920660b0c1e4dd5a9573004cd527e15184) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] Align functools.reduce() docstring with PEP-257 (GH-126045) (#126113)Miss Islington (bot)2024-10-291-6/+8
| | | | | | | Yak-shave in preparation for Argument Clinic adaption in gh-125999. (cherry picked from commit 9b14083497f50213f908c1359eeaf47c97161347) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* [3.13] gh-126035: add missing whitespace to *Py_EnterRecursiveCall() ↵Miss Islington (bot)2024-10-272-3/+3
| | | | | | | messages (GH-126036) (#126058) (cherry picked from commit 19e93e2e269889ecb3c4c039091abff489f247c2) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil ↵Miss Islington (bot)2024-10-271-1/+6
| | | | | | | | callback's `__eq__` in asyncio (GH-125967) (#126047) gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (GH-125967) (cherry picked from commit ed5059eeb1aa50b481957307db5a34b937497382) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due ↵Miss Islington (bot)2024-10-271-6/+13
| | | | | | | | to an evil `loop.__getattribute__` (GH-126003) (#126043) gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (GH-126003) (cherry picked from commit f819d4301d7c75f02be1187fda017f0e7b608816) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* [3.13] gh-125969: fix OOB in `future_schedule_callbacks` due to an evil ↵Miss Islington (bot)2024-10-251-17/+12
| | | | | | | | | `call_soon` (GH-125970) (#125991) gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (GH-125970) (cherry picked from commit c5b99f5c2c5347d66b9da362773969c531fb6c85) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.13] GH-125789: fix `fut._callbacks` to always return a copy of callbacks ↵Kumar Aditya2024-10-251-28/+25
| | | | | | | | | (#125922) (#125976) GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922) Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state. (cherry picked from commit cae853e3b44cd5cb033b904e163c490dd28bc30a)
* [3.13] gh-123978: Remove broken time.thread_time() on NetBSD (GH-124116) ↵Miss Islington (bot)2024-10-231-3/+15
| | | | | | | (GH-124425) (cherry picked from commit e670a113b5e1fcc3ce3bb9b5b4b1f126264ae21b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-125716: Use a Global Mutex When Initializing Global State For the ↵Miss Islington (bot)2024-10-212-57/+79
| | | | | | | | | | | _interpqueues Module (gh-125817) This includes a drive-by cleanup in _queues_init() and _queues_fini(). This change also applies to the _interpchannels module. (cherry picked from commit 4848b0b92ce2737cea08fa3b322fd0f0a671bb07, AKA gh-125803) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-125716: Raise an Exception If _globals_init() Fails In the ↵Miss Islington (bot)2024-10-212-3/+5
| | | | | | | | | | | _interpqueues Module (gh-125808) The fix applies to the _interpchannels module as well. I've also included a drive-by typo fix for _interpqueues. (cherry picked from commit 44f841f01af0fb038e142a07f15eda1ecdd5b08a, AKA gh-125802) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a ↵Miss Islington (bot)2024-10-211-15/+23
| | | | | | | | | | | string again (GH-125774) (GH-125804) This is a follow up of GH-124974. Only Glibc needed a fix. Now the returned value is a string consisting of semicolon-separated symbols on all Posix platforms. (cherry picked from commit dcc4fb2c9068f60353f0c0978948b7681f7745e6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-125667: Statically Initialize the Arg Converter Data Values in ↵Miss Islington (bot)2024-10-181-9/+9
| | | | | | | | _interpqueuesmodule.c (gh-125670) gh-125667: Statically Initialize the Arg Converter Data Values in _interpqueuesmodule.c (gh-125668) (cherry picked from commit 7cf2dbc3cb3ef7be65a98bbfc87246d36d795c82) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-52551: Fix encoding issues in strftime() (GH-125193) (GH-125657)Serhiy Storchaka2024-10-172-201/+203
| | | | | | | | | | | | | | | Fix time.strftime(), the strftime() method and formatting of the datetime classes datetime, date and time. * Characters not encodable in the current locale are now acceptable in the format string. * Surrogate pairs and sequence of surrogatescape-encoded bytes are no longer recombinated. * Embedded null character no longer terminates the format string. This fixes also gh-78662 and gh-124531. (cherry picked from commit ad3eac1963a5f195ef9b2c1dbb5e44fa3cce4c72)
* [3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-125281) ↵Miss Islington (bot)2024-10-152-20/+85
| | | | | | | | | | | | | (gh-125414) Lock `ZoneInfoType` to protect accesses to `ZONEINFO_STRONG_CACHE`. Refactor the `tp_new` handler to use Argument Clinic so that we can just use `@critical_section` annotations on the relevant functions. Also use `PyDict_SetDefaultRef` instead of `PyDict_SetDefault` when inserting into the `TIMEDELTA_CACHE`. (cherry picked from commit f1d33dbddd3496b062e1fbe024fb6d7b023a35f5) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.13] gh-124917: Allow keyword args to os.path.exists/lexists on Windows ↵Jelle Zijlstra2024-10-112-13/+71
| | | | | (GH-124918) (#125332) (cherry picked from commit cc2938a18967c9d462ebb18bc09f73e4364aa7d2)
* [3.13] gh-116738: Make `_csv` module thread-safe (GH-118344) (#125328)Miss Islington (bot)2024-10-111-9/+11
| | | | | | gh-116738: Make `_csv` module thread-safe (GH-118344) (cherry picked from commit a00221e5a70e54a281ba0e2cff8d85cd37ae305f) Co-authored-by: AN Long <aisk@users.noreply.github.com>