summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-110045: Update symtable module for PEP 695 (GH-110066) (#110070)Miss Islington (bot)2023-09-291-0/+8
| | | | | | gh-110045: Update symtable module for PEP 695 (GH-110066) (cherry picked from commit 7dc2c5093ef027aab57bca953ac2d6477a4a440b) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.12] gh-109496: Detect Py_DECREF() after dealloc in debug mode (GH-109539) ↵Miss Islington (bot)2023-09-181-0/+21
| | | | | | | | | | | | | | | | | (#109545) gh-109496: Detect Py_DECREF() after dealloc in debug mode (GH-109539) On a Python built in debug mode, Py_DECREF() now calls _Py_NegativeRefcount() if the object is a dangling pointer to deallocated memory: memory filled with 0xDD "dead byte" by the debug hook on memory allocators. The fix is to check the reference count *before* checking for _Py_IsImmortal(). Add test_decref_freed_object() to test_capi.test_misc. (cherry picked from commit 0bb0d88e2d4e300946e399e088e2ff60de2ccf8c) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] C API tests: use special markers to test that output parameters were ↵Serhiy Storchaka2023-09-086-20/+50
| | | | | | set (GH-109014) (#109023) [3.12] C API tests: use special markers to test that output parameters were set (GH-109014). (cherry picked from commit bf414b7fcb7c8ba780a5e1d9f320ecef0c7f9488)
* [3.12] gh-46376: Revert "Return existing pointer when possible in ctypes ↵Łukasz Langa2023-09-041-29/+0
| | | | | | | (GH-107131) (GH-107487)" (#108864) This reverts commit 54aaaadef8a44324f6be674707c67a3516470ff6. Co-authored-by: T. Wouters <thomas@python.org>
* [3.12] Add Modules/_testcapi/util.h header (GH-108774) (#108780)Miss Islington (bot)2023-09-026-93/+48
| | | | | | | | Add Modules/_testcapi/util.h header (GH-108774) It contains common macros used in C API tests. (cherry picked from commit 0e01fac315dfa705ac8a6954485546f28cf4c87d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268) ↵Erlend E. Aasland2023-08-292-2/+9
| | | | | | | | | | | (#108655) (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.12] gh-107801: Document io.TextIOWrapper.tell (#108265) (#108547)Erlend E. Aasland2023-08-272-3/+12
| | | (cherry picked from commit 38afa4af9bfc8297a5ee270c37f3f120a04297ea)
* [3.12] Clarify distinction between datetime module and class in deprecation ↵Miss Islington (bot)2023-08-271-4/+4
| | | | | | | | messages (GH-108073) (#108540) Clarify distinction between datetime module and class in deprecation messages (GH-108073) (cherry picked from commit 09343dba44cdb5c279ec51df34552ef451434958) Co-authored-by: Clément Robert <cr52@protonmail.com>
* [3.12] gh-107913: Fix possible losses of OSError error codes (GH-107930) ↵Miss Islington (bot)2023-08-2614-73/+122
| | | | | | | | | | | | (#108523) gh-107913: Fix possible losses of OSError error codes (GH-107930) 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) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107801: Improve the accuracy of io.TextIOWrapper.seek docs ↵Erlend E. Aasland2023-08-222-5/+39
| | | | | | | | | | | (#107933) (#108262) (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.12] gh-107915: Handle errors in C API functions PyErr_Set*() and ↵Miss Islington (bot)2023-08-202-1/+105
| | | | | | | | | | | | | | | | | | | | PyErr_Format() (GH-107918) (#108134) * gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918) Such C API functions as PyErr_SetString(), PyErr_Format(), PyErr_SetFromErrnoWithFilename() and many others no longer crash or ignore errors if it failed to format the error message or decode the filename. Instead, they keep a corresponding error. (cherry picked from commit 633ea217a85f6b6ba5bdbc73094254d5811b3485) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> * Define PY_SSIZE_T_CLEAN. --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108083: Don't ignore exceptions in sqlite3.Connection.__init__() ↵Erlend E. Aasland2023-08-191-31/+75
| | | | | | | | | | | | | | | | and .close() (#108084) (#108141) - Add explanatory comments - Add return value to connection_close() for propagating errors - Always check the return value of connection_exec_stmt() - Assert pre/post state in remove_callbacks() - Don't log unraisable exceptions in case of interpreter shutdown - Make sure we're not initialized if reinit fails - Try to close the database even if ROLLBACK fails (cherry picked from commit fd195092204aa7fc9f13c5c6d423bc723d0b3520) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107801: Improve the accuracy of os.lseek docs (#107935) (#108136)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.12] gh-106242: Fix path truncation in os.path.normpath (GH-106816) (#107981)Steve Dower2023-08-161-1/+3
| | | | | | | | | * gh-106242: Fix path truncation in os.path.normpath (GH-106816) * gh-106242: Minor fixup to avoid compiler warnings --------- Co-authored-by: Finn Womack <flan313@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107178: Add the C API tests for the Abstract Objects Layer ↵Serhiy Storchaka2023-08-165-163/+868
| | | | | | | | | | | | (GH-107179) (#107728) Cover all the Mapping Protocol, almost all the Sequence Protocol (except PySequence_Fast) and a part of the Object Protocol. Move existing tests to Lib/test/test_capi/test_abstract.py and Modules/_testcapi/abstract.c. Add also tests for PyDict C API.. (cherry picked from commit 16c9415fba4972743f1944ebc44946e475e68bc4)
* [3.12] gh-107735: Add C API tests for PySys_GetObject() and ↵Serhiy Storchaka2023-08-161-0/+41
| | | | | | PySys_SetObject() (GH-107736) (#107740) [3.12] gh-107735: Add C API tests for PySys_GetObject() and PySys_SetObject() (GH-107736). (cherry picked from commit bea5f93196d213d6fbf4ba8984caf4c3cd1da882)
* [3.12] gh-106844: Fix issues in _winapi.LCMapStringEx (GH-107832) (#107874)Serhiy Storchaka2023-08-162-16/+30
| | | | | | | | | | * 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. * Strings containing the null character were truncated at the first null character. Now strings longer than 2**31-1 characters caused OverflowError and the null character is allowed.. (cherry picked from commit 04cc01453db2f0af72a06440831637f8bf512daf)
* [3.12] gh-100061: Proper fix of the bug in the matching of possessive ↵Serhiy Storchaka2023-08-161-0/+4
| | | | | | | | | | quantifiers (GH-102612) (#108003) Restore the global Input Stream pointer after trying to match a sub-pattern. . (cherry picked from commit abd9cc52d94b8e2835322b62c29f09bb0e6fcfe9) Co-authored-by: SKO <41810398+uyw4687@users.noreply.github.com>
* [3.12] gh-91054: make code watcher tests resilient to other watchers ↵Miss Islington (bot)2023-08-111-3/+11
| | | | | | | | (GH-107821) (#107835) gh-91054: make code watcher tests resilient to other watchers (GH-107821) (cherry picked from commit 2ec16fed14aae896e38dd5bd9e73e2eddc974439) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] gh-107077: Raise SSLCertVerificationError even if the error is set ↵Miss Islington (bot)2023-08-031-0/+4
| | | | | | | via SSL_ERROR_SYSCALL (GH-107586) (#107587) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: T. Wouters <thomas@python.org>
* [3.12] gh-106263: Fix segfault in `signaldict_repr` in `_decimal` module ↵Charlie Zhao2023-07-311-3/+26
| | | | | | | (#… (#107491) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> (cherry picked from commit 3979150a0d406707f6d253d7c15fb32c1e005a77)
* [3.12] gh-46376: Return existing pointer when possible in ctypes (GH-107131) ↵Łukasz Langa2023-07-311-0/+29
| | | | | | | (#107487) (cherry picked from commit 08447b5deb47e2a0df87fa0a0576d300e5c909b4) Co-authored-by: Konstantin <kpp.live+github@gmail.com>
* [3.12] gh-106881: Check for linux/limits.h before including it (#107397) ↵justdan62023-07-281-1/+1
| | | | | | | | (#107414) * Check for linux/limits.h before including it Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> (cherry picked from commit 11c055f5ff1a353de6d2e77f2af24aaa782878ba)
* [3.12] gh-104432: Use `memcpy()` to avoid misaligned loads (GH-104433) (#107355)Miss Islington (bot)2023-07-272-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.12] gh-101524: Only Use Public C-API in the _xxsubinterpreters Module ↵Miss Islington (bot)2023-07-273-15/+5
| | | | | | | | (gh-105258) (gh-107303) The _xxsubinterpreters module was meant to only use public API. Some internal C-API usage snuck in over the last few years (e.g. gh-28969). This fixes that. (cherry picked from commit e6373c0d8b59512aa7f0dea7f3fb162b6ed10fa4) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-106350: Tkinter: do not ignore return value of `mp_init()` ↵Miss Islington (bot)2023-07-261-2/+3
| | | | | | | (GH-106351) (GH-107258) (cherry picked from commit b5ae7c498438657a6ba0bf4cc216b9c2c93a06c7) Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
* [3.12] gh-47146: Fix reference counting in _testcapi.structmember ↵Miss Islington (bot)2023-07-211-1/+1
| | | | | | | initializer (GH-106862) (GH-106953) (cherry picked from commit 8d397ee8259fa0f81598a452438fc335267ca260) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-86493: Fix possible leaks in some modules initialization ↵Serhiy Storchaka2023-07-188-43/+35
| | | | | | (GH-106768) (GH-106855) Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time. (cherry picked from commit 3e65baee72131b49f4ce8ca2da568a6f2001ce93)
* [3.12] gh-86493: Fix possible leaks in modules initialization: ↵Serhiy Storchaka2023-07-184-60/+41
| | | | | | _curses_panel, _decimal, posix, xxsubtype (GH-106767) (#106849) (cherry picked from commit 745492355b94d109e47827e5865846f25ae42d26)
* [3.12] gh-106831: Fix NULL check of d2i_SSL_SESSION() result in _ssl.c ↵Miss Islington (bot)2023-07-171-3/+4
| | | | | | | | (GH-106832) (#106835) 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.12] gh-106687: _ssl: use uint64_t for SSL options (GH-106700) (#106827)Miss Islington (bot)2023-07-171-26/+54
| | | | | | | | | | | | | gh-106687: _ssl: use uint64_t for SSL options (GH-106700) SSL_CTX_get_options() uses uint64_t for options: https://www.openssl.org/docs/man3.1/man3/SSL_CTX_get_options.html Fix this compiler warning on Windows with MSC: conversion from 'uint64_t' to 'long', possible loss of data (cherry picked from commit ad95c7253a70e559e7d3f25d53f4772f28bb8b44) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-105235: Prevent reading outside buffer during mmap.find() ↵Miss Islington (bot)2023-07-152-1/+120
| | | | | | | | | | | | | | (GH-105252) (#106708) 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) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* [3.12] gh-99593: Add tests for Unicode C API (part 3) (GH-104728) (GH-106595)Serhiy Storchaka2023-07-101-1/+506
| | | | Add tests for codecs. (cherry picked from commit 51ea664d18938645521bdd128a3c55f9c197644c)
* [3.12] gh-105227: Add PyType_GetDict() (GH-105747) (#106600)Miss Islington (bot)2023-07-101-0/+25
| | | | | | | | | | gh-105227: Add PyType_GetDict() (GH-105747) This compensates for static builtin types having `tp_dict` set to `NULL`. (cherry picked from commit a840806d338805fe74a9de01081d30da7605a29f) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-106524: Fix a crash in _sre.template() (GH-106525) (GH-106544)Miss Islington (bot)2023-07-081-0/+2
| | | | | | | | Some items remained uninitialized if _sre.template() was called with invalid indices. Then attempt to clear them in the destructor led to dereferencing of uninitialized pointer. (cherry picked from commit 2ef1dc37f02b08536b677dd23ec51541a60effd7) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
* [3.12] gh-91053: make func watcher tests resilient to other func watchers ↵Miss Islington (bot)2023-07-031-12/+11
| | | | | | | | (GH-106286) (#106365) gh-91053: make func watcher tests resilient to other func watchers (GH-106286) (cherry picked from commit 58906213cc5d8f2be311664766b4923ef29dae1f) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] GH-106152: Add PY_THROW event to cProfile (GH-106256)Miss Islington (bot)2023-06-291-0/+1
| | | | | | GH-106152: Add PY_THROW event to cProfile (GH-106161) (cherry picked from commit cea9d4ea82abcb2c6f1d83a2fe819859da4bbda4) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
* [3.12] gh-105987: Fix reference counting issue in `_asyncio._swap_cur… ↵Kumar Aditya2023-06-261-4/+7
| | | | | | | | (#106099) [3.12] gh-105987: Fix reference counting issue in `_asyncio._swap_current_task` (GH-105989). (cherry picked from commit d2cbb6e918d9ea39f0dd44acb53270f2dac07454) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
* [3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and Py… ↵Serhiy Storchaka2023-06-242-7/+8
| | | | | | | | | | (#106041) [3.12] 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.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752)Eric Snow2023-06-144-5/+128
| | | | For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run. (cherry picked from commit 757b402)
* [3.12] gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620) ↵Miss Islington (bot)2023-06-131-7/+7
| | | | | | | | (gh-105731) We are changing it to be more flexible that a strict bool can be for possible future expanded used cases. (cherry picked from commit b97e14a806477af4225777d215ac38c0d9b845f0) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-105375: Improve error handling in _Unpickler_SetInputStream() ↵Erlend E. Aasland2023-06-131-13/+18
| | | | | | | | (#105667) (#105720) Prevent exceptions from possibly being overwritten in case of multiple failures. (cherry picked from commit 217589d4f3246d67c6ef0eb0be2b1c33987cf260)
* [3.12] gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields ↵Miss Islington (bot)2023-06-121-37/+53
| | | | | | | | | | | | (GH-105686) (#105710) 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.12] gh-105436: The environment block should end with two null wchar_t ↵Miss Islington (bot)2023-06-121-1/+13
| | | | | | | | values (GH-105495) (#105700) 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.12] gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL ↵Miss Islington (bot)2023-06-121-0/+13
| | | | | | | | (GH-105386) (GH-105697) gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386) (cherry picked from commit 2b90796be6959d5ef46b38c434a514fce25be971) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-105375: Harden pyexpat initialisation (#105606) (#105669)Erlend E. Aasland2023-06-111-7/+11
| | | | | | (cherry picked from commit 20a56d8becba1a5a958b167fdb43b1a1b9228095) Add proper error handling to add_errors_module() to prevent exceptions from possibly being overwritten.
* [3.12] gh-105375: Improve error handling in _ctypes (GH-105593) (#105663)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.12] gh-105375: Improve posix error handling (GH-105592) (#105598)Miss Islington (bot)2023-06-111-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.12] gh-105375: Improve _decimal error handling (GH-105605) (#105647)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.12] gh-105375: Harden _datetime initialisation (GH-105604) (#105645)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>