summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-108851: Fix support.get_recursion_available() for USE_STACKCHECK ↵Victor Stinner2023-09-291-2/+8
| | | | | | | (#110127) Add _testcapi.USE_STACKCHECK. USE_STACKCHECK on using on Windows 32-bit.
* [3.11] gh-110052: Fix faulthandler for freed tstate (#110069) (#110072)Victor Stinner2023-09-291-2/+1
| | | | | | | | | | gh-110052: Fix faulthandler for freed tstate (#110069) faulthandler now detected freed interp and freed tstate, and no longer dereference them. Backport to 3.11: add pycore_pymem.h include to traceback.c. (cherry picked from commit 2e37a38bcbfbe1357436e030538290e7d00b668d)
* [3.11] gh-109098: Fuzz re module instead of internal sre (GH-109911) (GH-109933)Miss Islington (bot)2023-09-271-20/+16
| | | | | | | * Fix c-analyzer globals test failure * Put globals exception in ignored.tsv (cherry picked from commit a829356f86d597e4dfe92e236a6d711c8a464f16) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* [3.11] gh-109593: Fix reentrancy issue in multiprocessing resource_tracker ↵Miss Islington (bot)2023-09-261-0/+14
| | | | | | | | | | | | (GH-109629) (#109897) gh-109593: Fix reentrancy issue in multiprocessing resource_tracker (GH-109629) --------- (cherry picked from commit 0eb98837b60bc58e57ad3e2b35c6b0e9ab634678) Co-authored-by: Antoine Pitrou <antoine@python.org> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* [3.11] gh-109631: Allow interruption of short repeated regex matches ↵Miss Islington (bot)2023-09-262-2/+5
| | | | | | | | | (GH-109867) (GH-109885) Counting for signal checking now continues in new match from the point where it ended in the previous match instead of starting from 0. (cherry picked from commit 8ac2085b80eca4d9b2a1093d0a7da020fd12e11a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.11] gh-109795: `_thread.start_new_thread`: allocate thread bootstate ↵Victor Stinner2023-09-251-3/+6
| | | | | | | | | usin… (#109852) gh-109795: `_thread.start_new_thread`: allocate thread bootstate using raw memory allocator (#109808) (cherry picked from commit 1b8f2366b38c87b0450d9c15bdfdd4c4a2fc3a01) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
* [3.11] gh-109613: _pystat_fromstructstat() checks for exceptions (#109618) ↵Victor Stinner2023-09-211-46/+67
| | | | | | | | | | | | | | | | | | | (#109668) gh-109613: _pystat_fromstructstat() checks for exceptions (#109618) Fix os.stat() and os.DirEntry.stat(): check for exceptions. Previously, on Python built in debug mode, these functions could trigger a fatal Python error (and abort the process) when a function succeeded with an exception set. _pystat_fromstructstat() now exits immediately if an exception is raised, rather only checking for exceptions at the end. It fix following fatal error in fill_time(): Fatal Python error: _Py_CheckSlotResult: Slot * of type int succeeded with an exception set (cherry picked from commit d4cea794a7b9b745817d2bd982d35412aef04710)
* [3.11] gh-108987: Fix _thread.start_new_thread() race condition (#109135) ↵Victor Stinner2023-09-111-16/+31
| | | | | | | | | | | | | | | | | | | (#109272) gh-108987: Fix _thread.start_new_thread() race condition (#109135) Fix _thread.start_new_thread() race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. thread_run() calls PyEval_AcquireThread() which checks if the thread must exit. The problem was that tstate was dereferenced earlier in _PyThreadState_Bind() which leads to a crash most of the time. Move _PyThreadState_CheckConsistency() from thread_run() to _PyThreadState_Bind(). (cherry picked from commit 517cd82ea7d01b344804413ef05610934a43a241)
* [3.11] gh-104690: thread_run() checks for tstate dangling pointer (#109056) ↵Victor Stinner2023-09-081-2/+5
| | | | | | | | | | | | | | (#109134) gh-104690: thread_run() checks for tstate dangling pointer (#109056) thread_run() of _threadmodule.c now calls _PyThreadState_CheckConsistency() to check if tstate is a dangling pointer when Python is built in debug mode. Rename ceval_gil.c is_tstate_valid() to _PyThreadState_CheckConsistency() to reuse it in _threadmodule.c. (cherry picked from commit f63d37877ad166041489a968233b57540f8456e8)
* [3.11] gh-104372: Drop the GIL around the vfork() call. (#104782) (#104958)Gregory P. Smith2023-09-011-2/+19
| | | | | | | | | | | | | gh-104372: Drop the GIL around the vfork() call. (#104782) On Linux where the `subprocess` module can use the `vfork` syscall for faster spawning, prevent the parent process from blocking other threads by dropping the GIL while it waits for the vfork'ed child process `exec` outcome. This prevents spawning a binary from a slow filesystem from blocking the rest of the application. Fixes #104372. (cherry picked from commit d08679212d9af52dd074cd4a6abb440edb944c9c)
* [3.11] gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268) ↵Erlend E. Aasland2023-08-291-7/+14
| | | | | | | | | | | (#108656) (cherry picked from commit 8178a88bd81edae87d6974483e4de9b32e808797) - Add param docstrings - Link to os.SEEK_* constants - Mention the return value in the initial paragraph Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* [3.11] gh-107801: Document io.TextIOWrapper.tell (#108265) (#108548)Erlend E. Aasland2023-08-272-3/+12
| | | (cherry picked from commit 38afa4af9bfc8297a5ee270c37f3f120a04297ea)
* [3.11] gh-107913: Fix possible losses of OSError error codes (GH-107930) ↵Serhiy Storchaka2023-08-2714-75/+122
| | | | | | | | (GH-108524) Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code. (cherry picked from commit 2b15536fa94d07e9e286826c23507402313ec7f4)
* [3.11] Revert "gh-46376: Return existing pointer when possible in ctypes ↵Łukasz Langa2023-08-241-29/+0
| | | | | | | (GH-107131) (GH-107488)" (#108412) This reverts commit 57f27e444175a8a5ffcd86971e06de61c1c38628. The fix caused gh-107940. Until we have a bulletproof fix for that, the 3.11 backport needs to be reverted to make way for 3.11.5.
* [3.11] Trim trailing whitespace and test on CI (GH-104275) (#108215)Hugo van Kemenade2023-08-2216-109/+109
|
* [3.11] gh-102507 Remove invisible pagebreak characters (GH-102531) (#108266)Miss Islington (bot)2023-08-221-3/+0
| | | | | | | gh-102507 Remove invisible pagebreak characters (GH-102531) (cherry picked from commit b097925858c6975c73e989226cf278cc382c0416) Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com> Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
* [3.11] gh-107801: Improve the accuracy of io.TextIOWrapper.seek docs ↵Erlend E. Aasland2023-08-222-5/+39
| | | | | | | | | | | (#107933) (#108264) (cherry picked from commit 7f87ebbc3f52680c939791f397b9a478edf0c8d4) Clearly document the supported seek() operations: - Rewind to the start of the stream - Restore a previous stream position (given by tell()) - Fast-forward to the end of the stream
* [3.11] gh-107801: Improve the accuracy of os.lseek docs (#107935) (#108137)Erlend E. Aasland2023-08-192-8/+22
| | | | | | | | | | - name the last parameter *whence*, like it is for seek() methods on file objects - add param docstrings - structure the valid *whence* params (cherry picked from commit dd4442c8f597af1ec3eaf20f7ad89c4ac7e2dbc9) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* [3.11] gh-100061: Proper fix of the bug in the matching of possessive ↵Serhiy Storchaka2023-08-161-0/+4
| | | | | | | | | | | | quantifiers (GH-102612) (GH-108004) Restore the global Input Stream pointer after trying to match a sub-pattern. Co-authored-by: Ma Lin <animalize@users.noreply.github.com> (cherry picked from commit abd9cc52d94b8e2835322b62c29f09bb0e6fcfe9) Co-authored-by: SKO <41810398+uyw4687@users.noreply.github.com>
* [3.11] gh-106242: Fix path truncation in os.path.normpath (GH-106816) (#107982)Steve Dower2023-08-151-1/+3
| | | Co-authored-by: Finn Womack <flan313@gmail.com>
* [3.11] gh-106844: Fix issues in _winapi.LCMapStringEx (GH-107832) (GH-107875)Serhiy Storchaka2023-08-121-12/+14
| | | | | | | | | * Strings with length from 2**31-1 to 2**32-2 always caused MemoryError, it doesn't matter how much memory is available. * Strings with length exactly 2**32-1 caused OSError. * Strings longer than 2**32-1 characters were truncated due to integer overflow bug. Now strings longer than 2**31-1 characters caused OverflowError. (cherry picked from commit 04cc01453db2f0af72a06440831637f8bf512daf)
* [3.11] gh-107735: Add C API tests for PySys_GetObject() and ↵Serhiy Storchaka2023-08-071-0/+41
| | | | | PySys_SetObject() (GH-107736) (GH-107741) (cherry picked from commit bea5f93196d213d6fbf4ba8984caf4c3cd1da882)
* [3.11] gh-107077: Raise SSLCertVerificationError even if the error is set ↵Miss Islington (bot)2023-08-031-0/+4
| | | | | | | via SSL_ERROR_SYSCALL (GH-107586) (#107588) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: T. Wouters <thomas@python.org>
* [3.11] gh-106263: Fix segfault in `signaldict_repr` in `_decimal` module ↵Charlie Zhao2023-07-311-3/+27
| | | | | | | (#… (#107490) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> (cherry picked from commit 3979150a0d406707f6d253d7c15fb32c1e005a77)
* [3.11] gh-46376: Return existing pointer when possible in ctypes (GH-107131) ↵Łukasz Langa2023-07-311-0/+29
| | | | | | | (#107488) (cherry picked from commit 08447b5deb47e2a0df87fa0a0576d300e5c909b4) Co-authored-by: Konstantin <kpp.live+github@gmail.com>
* [3.11] gh-106881: Check for linux/limits.h before including it (#107397) ↵justdan62023-07-281-1/+1
| | | | | | | | | | | | (#107415) * [3.11] gh-106881: Check for linux/limits.h before including it (#107397) * Check for linux/limits.h before including it Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> (cherry picked from commit 11c055f5ff1a353de6d2e77f2af24aaa782878ba) * Fix sphinx-lint error in NEWS entry
* [3.11] gh-104432: Use `memcpy()` to avoid misaligned loads (GH-104433) (#107356)Miss Islington (bot)2023-07-282-7/+25
| | | | | | | | | | gh-104432: Use `memcpy()` to avoid misaligned loads (GH-104433) Fix potential unaligned memory access on C APIs involving returned sequences of `char *` pointers within the :mod:`grp` and :mod:`socket` modules. These were revealed using a ``-fsaniziter=alignment`` build on ARM macOS. (cherry picked from commit f01e4cedba1a17d321664834bb255d9d04ad16ce) Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
* [3.11] gh-106350: Tkinter: do not ignore return value of `mp_init()` ↵Miss Islington (bot)2023-07-261-2/+3
| | | | | | | (GH-106351) (GH-107259) (cherry picked from commit b5ae7c498438657a6ba0bf4cc216b9c2c93a06c7) Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
* [3.11] gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data ↵Serhiy Storchaka2023-07-251-1/+36
| | | | | | | (GH-99613) (GH-107224) Previously *consumed was not set in this case. (cherry picked from commit f08e52ccb027f6f703302b8c1a82db9fd3934270)
* [3.11] gh-86493: Fix possible leaks in some modules initialization ↵Serhiy Storchaka2023-07-198-43/+34
| | | | | | | | | (GH-106768) (GH-106855) (GH-106863) [3.11] [3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855) Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time. (cherry picked from commit 3e65baee72131b49f4ce8ca2da568a6f2001ce93). (cherry picked from commit a423ddbdeada8a2fd8657453b9e9f58ba0dd921d)
* [3.11] gh-86493: Fix possible leaks in modules initialization: ↵Serhiy Storchaka2023-07-184-84/+43
| | | | | | | _curses_panel, _decimal, posix, xxsubtype (GH-106767) (GH-106849) (GH-106851) (cherry picked from commit 745492355b94d109e47827e5865846f25ae42d26) (cherry picked from commit 970cb8eabaaf5a8311f1aba4ca4968ef7385fce8)
* [3.11] gh-106831: Fix NULL check of d2i_SSL_SESSION() result in _ssl.c ↵Miss Islington (bot)2023-07-171-3/+4
| | | | | | | | (GH-106832) (#106836) gh-106831: Fix NULL check of d2i_SSL_SESSION() result in _ssl.c (GH-106832) (cherry picked from commit ebf2c56b33553a448da8f60fcd89a622f071b5f4) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.11] gh-105235: Prevent reading outside buffer during mmap.find() (… ↵Dennis Sweeney2023-07-152-1/+120
| | | | | | | | | | | | (#106710) [3.11] gh-105235: Prevent reading outside buffer during mmap.find() (GH-105252) * Add a special case for s[-m:] == p in _PyBytes_Find * Add tests for _PyBytes_Find * Make sure that start <= end in mmap.find. (cherry picked from commit ab86426a3472ab68747815299d390b213793c3d1)
* [3.11] gh-106033: Get rid of new occurrences of PyDict_GetItem and Py… ↵Serhiy Storchaka2023-06-241-6/+7
| | | | | | | | | | (#106040) [3.11] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034) These functions are broken by design because they discard any exceptions raised inside, including MemoryError and KeyboardInterrupt. They should not be used in new code.. (cherry picked from commit 1d33d5378058671bfabb6f4d4b5bfd4726973ff9)
* [3.11] gh-105375: Improve error handling in _Unpickler_SetInputStream() ↵Erlend E. Aasland2023-06-131-13/+18
| | | | | | | | (#105667) (#105721) Prevent exceptions from possibly being overwritten in case of multiple failures. (cherry picked from commit 217589d4f3246d67c6ef0eb0be2b1c33987cf260)
* [3.11] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields ↵Erlend E. Aasland2023-06-131-37/+52
| | | | | | | | | | | | | | (#105686) (#105711) * [3.11] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (#105686) All fields must be explicitly initialised to prevent manipulation of uninitialised fields in dealloc. Align initialisation order with the layout of the object structs. (cherry picked from commit ca3cc4b95d66f7527ebe0ba4cdb1907082d9bfc8) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105436: The environment block should end with two null wchar_t ↵Miss Islington (bot)2023-06-121-1/+13
| | | | | | | | values (GH-105495) (#105701) gh-105436: The environment block should end with two null wchar_t values (GH-105495) (cherry picked from commit 4f7d3b602d47d61137e82145f601dccfe6f6cd3c) Co-authored-by: Dora203 <66343334+sku2000@users.noreply.github.com>
* [3.11] gh-105375: Harden pyexpat initialisation (#105606) (#105668)Erlend E. Aasland2023-06-111-9/+11
| | | | | | (cherry picked from commit 20a56d8becba1a5a958b167fdb43b1a1b9228095) Add proper error handling to add_errors_module() to prevent exceptions from possibly being overwritten.
* [3.11] gh-105375: Improve error handling in _ctypes (GH-105593) (#105664)Miss Islington (bot)2023-06-111-4/+14
| | | | | | | Prevent repeated PyLong_FromVoidPtr() from possibly overwriting the current exception. (cherry picked from commit e8998e46a7ce8ad336e0941a6da6e50cb88d1e47) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Harden _ssl initialisation (#105599) (#105651)Erlend E. Aasland2023-06-111-6/+15
| | | | | | | | (cherry picked from commit 01f4230460454d4a849a5ba93320142c1a0c93a8) Add proper error handling to prevent reference leaks and overwritten exceptions. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve _decimal error handling (GH-105605) (#105648)Miss Islington (bot)2023-06-111-1/+5
| | | | | | Fix a bug where an exception could end up being overwritten. (cherry picked from commit c932f7284977ebf813313157c52d716ba225a7ac) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Harden _datetime initialisation (GH-105604) (#105646)Miss Islington (bot)2023-06-111-5/+30
| | | | | | Improve error handling so init bails on the first exception. (cherry picked from commit 16d49680b56e00c53c00683b949138e584669fd3) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve array.array exception handling (GH-105594) (#105643)Miss Islington (bot)2023-06-111-3/+5
| | | | | | Fix a bug where 'tp_richcompare' could end up overwriting an exception. (cherry picked from commit 35cff545db7c7912046c0ce5627db2e4d2b60f57) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve error handling in `zoneinfo` module (GH-105586) ↵Miss Islington (bot)2023-06-091-6/+11
| | | | | | | | | | | (#105613) Fix bugs where exceptions could end up being overwritten because of deferred error handling. (cherry picked from commit 33c92c4f15539806c8aff8574ff30a8b307e3e4d) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve error handling in _elementtree (GH-105591) (#105601)Miss Islington (bot)2023-06-091-3/+7
| | | | | | Fix bugs where exceptions could end up being overwritten. (cherry picked from commit 00b599ab5a76023fa0083d7cc5d3c569342a5191) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve posix error handling (GH-105592) (#105597)Miss Islington (bot)2023-06-091-4/+8
| | | | | | Fix a bug where an IndexError could end up being overwritten. (cherry picked from commit f668f73bc88cce0112b304d87aa998fb28013c71) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-105375: Improve errnomodule error handling (#105590) (#105595)Erlend E. Aasland2023-06-091-2/+5
| | | | | | (cherry picked from commit eede1d2f48b4fe7f7918952d9ebeb744b58668c1) Bail immediately if an exception is set, to prevent exceptions from being overwritten.
* [3.11] gh-105375: Improve _pickle error handling (#105475) (#105583)Erlend E. Aasland2023-06-091-12/+27
| | | | | | (cherry picked from commit 89aac6f6b7b3af046ec137121c90732289e79efc) Error handling was deferred in some cases, which could potentially lead to exceptions being overwritten.
* [3.11] gh-105375: Improve error handling in sqlite3 collation callback ↵Miss Islington (bot)2023-06-071-3/+5
| | | | | | | | (GH-105412) (#105441) Check for error after each call to PyUnicode_FromStringAndSize(). (cherry picked from commit a24a780d937109a0982d807473ae410cc75b0e3b) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.11] gh-104399: Use newer libtommath APIs when necessary (GH-104407) (#105344)Miss Islington (bot)2023-06-061-2/+21
| | | | | | gh-104399: Use newer libtommath APIs when necessary (GH-104407) (cherry picked from commit 00d73caf804c0474980e471347d6385757af975f) Co-authored-by: Christopher Chavez <chrischavez@gmx.us>