summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [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>
* [3.12] gh-105375: Harden _ssl initialisation (GH-105599) (#105642)Miss Islington (bot)2023-06-111-5/+11
| | | | | | | Add proper error handling to prevent reference leaks and overwritten exceptions. (cherry picked from commit 01f4230460454d4a849a5ba93320142c1a0c93a8) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-105375: Improve array.array exception handling (GH-105594) (#105644)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.12] gh-105375: Improve error handling in `zoneinfo` module (GH-105586) ↵Miss Islington (bot)2023-06-091-6/+11
| | | | | | | | | | | (#105612) 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.12] gh-105375: Harden error handling in `_testcapi/heaptype.c` ↵Miss Islington (bot)2023-06-091-1/+4
| | | | | | | | (GH-105608) (#105615) Bail on first error in heapctypesubclasswithfinalizer_finalize() (cherry picked from commit d636d7dfe714e7168b342c7ea5f9f9d3b3569ed0) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-105375: Improve error handling in _elementtree (GH-105591) (#105600)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.12] gh-105375: Improve errnomodule error handling (#105590) (#105596)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.12] gh-105375: Improve _pickle error handling (#105475) (#105584)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.12] gh-94673: Ensure subtypes are readied only once in math.trunc() ↵Miss Islington (bot)2023-06-071-1/+1
| | | | | | | | (gh-105465) (gh-105471) Fixes a typo in d2e2e53. (cherry picked from commit 5394bf92aa6516feb3322d8372d1579bd9c1417b) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* [3.12] Fix grammar and improve clarity for an deprecation message. ↵Miss Islington (bot)2023-06-071-2/+2
| | | | (GH-105457) (#105458)
* [3.12] gh-105375: Improve error handling in sqlite3 collation callback ↵Miss Islington (bot)2023-06-071-3/+5
| | | | | | | | (GH-105412) (#105440) 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.12] gh-104399: Use newer libtommath APIs when necessary (GH-104407) (#105343)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>
* [3.12] gh-102304: doc: Add links to Stable ABI and Limited C API (#105345) ↵Victor Stinner2023-06-061-1/+1
| | | | | | | | | | | | | | | | | | | (#105371) * gh-102304: doc: Add links to Stable ABI and Limited C API (#105345) * Add "limited-c-api" and "stable-api" references. * Rename "stable-abi-list" reference to "limited-api-list". * Makefile: Document files regenerated by "make regen-limited-abi" * Remove first empty line in generated files: - Lib/test/test_stable_abi_ctypes.py - PC/python3dll.c (cherry picked from commit bae415ad02c79cf3a2eec4aa6969221a12e6716f) * gh-102304: Fix up Simple ABI doc (GH-105351) (cherry picked from commit 0202aa002e06acef9aa55ace0d939103df19cadd)
* [3.12] gh-104690 Disallow thread creation and fork at interpreter ↵Miss Islington (bot)2023-06-043-2/+30
| | | | | | | | | | | | | | | | | | | | | finalization (GH-104826) (#105277) gh-104690 Disallow thread creation and fork at interpreter finalization (GH-104826) Disallow thread creation and fork at interpreter finalization. in the following functions, check if interpreter is finalizing and raise `RuntimeError` with appropriate message: * `_thread.start_new_thread` and thus `threading` * `posix.fork` * `posix.fork1` * `posix.forkpty` * `_posixsubprocess.fork_exec` when a `preexec_fn=` is supplied. --------- (cherry picked from commit ce558e69d4087dd3653207de78345fbb8a2c7835) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.12] gh-104614: Fix potential ref. leak in ↵Miss Islington (bot)2023-06-021-1/+3
| | | | | | | _testcapimodule/get_basic_static_type() (GH-105225) (#105248) (cherry picked from commit e01b04c9075c6468ed57bc883693ec2a06a6dd8e) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-104614: Make Sure ob_type is Always Set Correctly by ↵Miss Islington (bot)2023-06-011-0/+45
| | | | | | | | | | PyType_Ready() (gh-105122) (gh-105211) When I added the relevant condition to type_ready_set_bases() in gh-103912, I had missed that the function also sets tp_base and ob_type (if necessary). That led to problems for third-party static types. We fix that here, by making those extra operations distinct and by adjusting the condition to be more specific. (cherry picked from commit 1469393) Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
* [3.12] gh-105020: Share tp_bases and tp_mro Between Interpreters For All ↵Miss Islington (bot)2023-06-011-0/+23
| | | | | | | | Static Builtin Types (gh-105115) (gh-105124) In gh-103912 we added tp_bases and tp_mro to each PyInterpreterState.types.builtins entry. However, doing so ignored the fact that both PyTypeObject fields are public API, and not documented as internal (as opposed to tp_subclasses). We address that here by reverting back to shared objects, making them immortal in the process. (cherry picked from commit 7be667d) Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
* [3.12] gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (GH-105174) ↵Miss Islington (bot)2023-06-014-3/+8775
| | | | | | | | | | | | | | | | | | | | (#105199) gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (GH-105174) Upgrade builds to OpenSSL 1.1.1u. This OpenSSL version addresses a pile if less-urgent CVEs since 1.1.1t. The Mac/BuildScript/build-installer.py was already updated. Also updates _ssl_data_111.h from OpenSSL 1.1.1u, _ssl_data_300.h from 3.0.9, and adds a new _ssl_data_31.h file from 3.1.1 along with the ssl.c code to use it. Manual edits to the _ssl_data_300.h file prevent it from removing any existing definitions in case those exist in some peoples builds and were important (avoiding regressions during backporting). backports of this prior to 3.12 will not include the openssl 3.1 header. (cherry picked from commit ede89af605b1c0442353435ad22195c16274f65d) Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
* [3.12] gh-89886: Rely on HAVE_SYS_TIME_H (GH-105058) (#105192)Miss Islington (bot)2023-06-012-0/+6
| | | | | | | | | | | Quoting autoconf (v2.71): All current systems provide time.h; it need not be checked for. Not all systems provide sys/time.h, but those that do, all allow you to include it and time.h simultaneously. (cherry picked from commit 9ab587b7146618866cee52c220aecf7bd5b44b02) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-102251: Explicitly free state for test modules with state in ↵Miss Islington (bot)2023-05-311-1/+21
| | | | | | | | test_import (GH-105085) (#105170) (cherry picked from commit a99b9d911e0f8cb11b3436bdd8eb649b15d01a50) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-88745: Add _winapi.CopyFile2 and update shutil.copy2 to use it (GH-105055)Miss Islington (bot)2023-05-302-1/+164
| | | | | (cherry picked from commit cda1bd3c9d3b2cecdeeba0c498cd2df83fbdb535) Co-authored-by: Steve Dower <steve.dower@python.org>
* [3.12] gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* ↵Irit Katriel2023-05-302-1/+49
| | | | | implementation in the unstable API (GH-105072) (#105095) (cherry picked from commit b7aadb4583b040ddc8564896b91f4e5e571c82d6)
* [3.12] gh-102251: Fix reference leak in _testsinglephase initialization ↵Miss Islington (bot)2023-05-301-1/+3
| | | | | | | | | | (GH-105082) (#105083) Correctly decref 'initialized' in init_module() (cherry picked from commit d14eb3433cf2a40a202471b815f0a935f2840ead) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-104820: Fixes os.stat on Windows to better handle file systems that do ↵Miss Islington (bot)2023-05-291-4/+8
| | | | | | | not support FileIdInformation (GH-104892) (cherry picked from commit 6031727a37c6003f78e3b0c7414a0a214855dd08) Co-authored-by: Steve Dower <steve.dower@python.org>