summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* gh-98178: syslog() is not thread-safe on macOS (GH-98213)Miss Islington (bot)2022-10-131-0/+5
| | | | | | | | | On macOS, fix a crash in syslog.syslog() in multi-threaded applications. On macOS, the libc syslog() function is not thread-safe, so syslog.syslog() no longer releases the GIL to call it. (cherry picked from commit d4b91663857e85eab1f309cacec4d27b5f6657ec) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.10] Add more syslog tests (GH-97953). (GH-98101)Serhiy Storchaka2022-10-091-1/+1
| | | | (cherry picked from commit cae7d1d7a713f8267daf5e4f2fff5cb1dad02c7c)
* [3.10] gh-96288: Add a sentence to `os.mkdir`'s docstring. (GH-96271). (#98066)Jelle Zijlstra2022-10-082-4/+6
| | | | | (cherry picked from commit 1523c9e9d47e7d67e4889987ff0f38eb7b881fdd) Co-authored-by: Hagai Helman Tov <hagai.helman@gmail.com>
* gh-65496: Correct wording on csv's skipinitialspace argument (GH-96170)Miss Islington (bot)2022-10-071-4/+4
| | | | | (cherry picked from commit 676d8ef3806758bcd1d3fd84a746c8a9b64480d0) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
* fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). ↵Miss Islington (bot)2022-10-071-1/+6
| | | | | | | (gh-97965) (cherry picked from commit b9d2e8171696514e9226164005f7bf24bf69e66d) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* [3.10] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK ↵Miss Islington (bot)2022-10-061-8/+52
| | | | | | | | | | | | | (GH-97944) (#97967) The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls. Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a segfault if cpython is built with the macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding runtime support for detection of these system calls ("weaklinking") as is done for other newer syscalls on macOS. (cherry picked from commit 6d0a0191a4e5477bd843e62c24d7f3bcad4fd5fc) Co-authored-by: Ned Deily <nad@python.org>
* [3.10] gh-97728: Argument Clinic: Fix uninitialized variable in the ↵Serhiy Storchaka2022-10-033-12/+12
| | | | | | | | Py_UNICODE converter (GH-97729) (GH-97760) It affects function os.system() on Windows and Windows-specific modules winreg, _winapi, _overlapped, and _msi. (cherry picked from commit 0ee9619a4cba58730c45e65d22288fadbf7680de)
* GH-97592: Fix crash in C remove_done_callback due to evil code (GH-97660)Miss Islington (bot)2022-09-301-2/+7
| | | | | | Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4599acc2c5ee8af5f37ab76c162ad21065) Co-authored-by: Guido van Rossum <guido@python.org>
* gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006)Miss Islington (bot)2022-09-227-17/+27
| | | | | | Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org> (cherry picked from commit 10e3d398c31cc1695752fc52bc6ca2ce9ef6237e) Co-authored-by: Dong-hee Na <donghee.na@python.org>
* gh-96821: Fix undefined behaviour in `_testcapimodule.c` (GH-96915) (GH-96926)Miss Islington (bot)2022-09-191-1/+3
| | | | | | | | | | * gh-96821: Assert for demonstrating undefined behaviour * Fix UB (cherry picked from commit cbdeda8ce7a3543cb3376d70e4cd46fcf24f42a7) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
* gh-96652: Fix faulthandler chained signal without sigaction() (GH-96666)Miss Islington (bot)2022-09-081-1/+1
| | | | | | | | Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL. (cherry picked from commit c580a81af91af4b9df85e466f8b48c3c9c86c3df) Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-96641: Do not expose `KeyWrapper` in `_functoolsmodule.c` (gh-96642)Miss Islington (bot)2022-09-071-3/+2
| | | | | (cherry picked from commit 2fd7246e97c8cc09b4e3f22933693f9d68f08163) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* fixes gh-96292: Fix Trivial Typo in cpython/Modules/atexitmodule.c (GH-96327)Miss Islington (bot)2022-08-271-1/+1
| | | | | (cherry picked from commit 0ace820bec8892d621a4aadc1feb6c56e25560bf) Co-authored-by: Ansab Gillani <56605828+ansabgillani@users.noreply.github.com>
* gh-95878: Fix format char in datetime CAPI tests (GH-95879)Miss Islington (bot)2022-08-111-4/+4
| | | | | (cherry picked from commit 8b34e914bba2ccd6ae39609410db49d0beb19cb1) Co-authored-by: Christian Heimes <christian@python.org>
* gh-91838: Resolve HTTP links which redirect to HTTPS (GH-95642)Miss Islington (bot)2022-08-041-1/+1
| | | | | | | It updates links which redirect to HTTPS with different authority or path. (cherry picked from commit d0d0154443cafb2f0a2cdfb6a1267d80cce8388e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] bpo-46053: Fix OSS audio support on NetBSD (GH-30065). (GH-95477)Thomas Klausner2022-07-311-0/+78
| | | | | (cherry picked from commit 2e7e3c4c109928870c1e33d8af36b78e92895594) Co-authored-by: Thomas Klausner <tk@giga.or.at>
* [3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345)Kumar Aditya2022-07-282-10/+14
| | | | | (cherry picked from commit 4dd099bafff14639ef5d2185965016d8f253353f) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315)Miss Islington (bot)2022-07-271-0/+1
| | | | | | Automerge-Triggered-By: GH:pablogsal (cherry picked from commit deacf391d7a1b3ab49bffa16088b3500fdb4c435) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails ↵Miss Islington (bot)2022-07-261-1/+7
| | | | | | | (GH-95264) (cherry picked from commit b1f648efc56ff17e18ec2b7402d59a771b305004) Co-authored-by: Noam Cohen <noam@noam.me>
* gh-95041: Fix several minor issues in syslog.openlog() (GH-95058)Miss Islington (bot)2022-07-261-24/+33
| | | | | | | | | | | | | | * syslog_get_argv() swallows exceptions, but not in all cases. * if ident is non UTF-8 encodable, syslog.openlog() fails after setting the global reference to ident. Now the C string saved internally in the previous call to openlog() points to the freed memory. * PySys_Audit() can crash if ident is NULL. * There may be a race condition with syslog.syslog(), because the global reference to ident is decrefed before setting the new value. * Possible use of freed memory if syslog.openlog() is called while the GIL is released in syslog.syslog(). (cherry picked from commit 68c555a50a2b74731b0db0f4dcbf51b2c11d4853) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-95095: Use SSL_CTX_get_max_proto_version instead of SSL_CTX_ctrl (GH-95096)Miss Islington (bot)2022-07-211-2/+2
| | | | | | | | | | The wrapper macros are more readable and match the form recommended in the OpenSSL documentation. They also slightly less error-prone, as the mapping of arguments to SSL_CTX_ctrl is not always clear. (Though in this case it's straightforward.) https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_get_max_proto_version.html (cherry picked from commit 936f71e5d4f50f2238b0320d44f7fb5f88e39809) Co-authored-by: David Benjamin <davidben@davidben.net>
* [3.10] gh-94930: skipitem() in getargs.c should return non-NULL on error ↵Miss Islington (bot)2022-07-191-2/+21
| | | | | | | | (GH-94931) (GH-94963) (cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* GH-91153: Handle mutating __index__ methods in bytearray item assignment ↵Miss Islington (bot)2022-07-191-0/+16
| | | | | | | (GH-94891) (cherry picked from commit f36589510b8708fa224d799d5b328deab558aa4e) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* gh-94821: Fix autobind of empty unix domain address (GH-94826)Miss Islington (bot)2022-07-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When binding a unix socket to an empty address on Linux, the socket is automatically bound to an available address in the abstract namespace. >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) >>> s.bind("") >>> s.getsockname() b'\x0075499' Since python 3.9, the socket is bound to the one address: >>> s.getsockname() b'\x00' And trying to bind multiple sockets will fail with: Traceback (most recent call last): File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind s2.bind("") OSError: [Errno 98] Address already in use Added 2 tests: - Auto binding empty address on Linux - Failing to bind an empty address on other platforms Fixes f6b3a07b7df6 (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866) (cherry picked from commit c22f134211743cd5ad14cec1dd4f527bee542b4c) Co-authored-by: Nir Soffer <nsoffer@redhat.com>
* bpo-45924: Fix asyncio incorrect traceback when future's exception is raised ↵Miss Islington (bot)2022-07-111-0/+14
| | | | | | | | | multiple times (GH-30274) (#94748) (cherry picked from commit 86c1df18727568758cc329baddc1836e45664023) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-94736: Fix _multiprocessing.SemLock subclassing (GH-94738)Miss Islington (bot)2022-07-111-4/+2
| | | | | | | | | | | | * fix allocator and deallocator * 📜🤖 Added by blurb_it. * code review Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit f5b76330cfb93e1ad1a77c71dafe719f6a808cec) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-94637: Release GIL in SSLContext.set_default_verify_paths (GH-94658)Miss Islington (bot)2022-07-091-1/+5
| | | | | (cherry picked from commit 78307c7dc2352b6633138466debd4c10fae32970) Co-authored-by: Christian Heimes <christian@python.org>
* [3.10] gh-94321: Document sqlite3.PrepareProtocol (GH-94620) (#94671)Erlend Egeberg Aasland2022-07-071-0/+3
| | | | | (cherry picked from commit fb6dccae348b954d9f625031b54711a9a33da525) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* GH-94644: fix test_curses ref leak (GH-94647)Miss Islington (bot)2022-07-071-0/+1
| | | | | (cherry picked from commit 277f55cb04409ccdf651d43df5eb9dcb3ee3128c) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.10] gh-94510: Raise on re-entrant calls to sys.setprofile and syssettrace ↵Pablo Galindo Salgado2022-07-051-1/+1
| | | | | | (GH-94511) (#94579) Co-authored-by: Łukasz Langa <lukasz@langa.pl>. Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup ↵Kumar Aditya2022-06-281-1/+5
| | | | (GH-94298) (#94385)
* GH-94254: Make _struct module types immutable (GH-94269)Miss Islington (bot)2022-06-261-2/+4
| | | | | (cherry picked from commit 17ed560fcd0a1442485f9bd48884bbe412f35abc) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.10] gh-90016: Reword sqlite3 adapter/converter docs (GH-93095) (#94273)Erlend Egeberg Aasland2022-06-252-11/+11
| | | | | | | Also add adapters and converter recipes. Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com. (cherry picked from commit bd3c1c187e0e4fde5aec6835d180e9eddde8ceb6)
* [3.10] gh-94207: Fix struct module leak (GH-94239) (GH-94266)Miss Islington (bot)2022-06-251-2/+20
| | | | | | | | | | | | | | | | * gh-94207: Fix struct module leak (GH-94239) Make _struct.Struct a GC type This fixes a memory leak in the _struct module, where as soon as a Struct object is stored in the cache, there's a cycle from the _struct module to the cache to Struct objects to the Struct type back to the module. If _struct.Struct is not gc-tracked, that cycle is never collected. This PR makes _struct.Struct GC-tracked, and adds a regression test. (cherry picked from commit 6b865349aae47b90f9ef0b98f3fe3720c2f05601) Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* Fix typo in _io.TextIOWrapper Clinic input (GH-94037) (GH-94117)Miss Islington (bot)2022-06-221-2/+2
| | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit ca308c13daa722f3669a14f1613da768086beb6a) Co-authored-by: fikotta <81991278+fikotta@users.noreply.github.com>
* gh-94101 Disallow instantiation of SSLSession objects (GH-94102)Miss Islington (bot)2022-06-221-1/+2
| | | | | | | | Fixes GH-94101 Automerge-Triggered-By: GH:tiran (cherry picked from commit dc8e1d0390e16e90b2f74f6bd6417324a357bc23) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
* DOC: correct bytesarray -> bytearray in comments (GH-92410) (GH-94090)Miss Islington (bot)2022-06-222-2/+2
| | | | | (cherry picked from commit 0709586744ec58dd60492e16b08fff6dc1149a0a) Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
* gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025)Victor Stinner2022-06-204-5/+9
| | | | | (cherry picked from commit 774ef28814d0d9d57ec813cb31b0a7af6c476127) Co-authored-by: Christian Heimes <christian@python.org>
* [3.10] gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs ↵Erlend Egeberg Aasland2022-06-192-10/+22
| | | | | | | | (GH-93926) (#94011) Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>. (cherry picked from commit 6446592c89b0c581c00e170ae6278291e940755c) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* [3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93801)Erlend Egeberg Aasland2022-06-141-75/+45
| | | | | | | | | | | The fix involves using pysqlite_check_remaining_sql(), not only to check for multiple statements, but now also to strip leading comments and whitespace from SQL statements, so we can improve DML query detection. pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more accurately reflect its function, and hardened to handle more SQL comment corner cases. (cherry picked from commit 46740073ef32bf83964c39609c7a7a4772c51ce3)
* gh-92930: _pickle.c: Acquire strong references before calling save() (GH-92931)Miss Islington (bot)2022-06-111-11/+36
| | | | | (cherry picked from commit 4c496f1f115a7910d4606b4de233d14874c77bfa) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for ↵Steve Dower2022-06-102-1/+118
| | | | | case-folding (GH-93674) Co-authored-by: AN Long <aisk@users.noreply.github.com>
* gh-90763: Modernise xx template module initialisation (GH-93078)Miss Islington (bot)2022-06-102-43/+54
| | | | | | | Use C APIs such as PyModule_AddType instead of PyModule_AddObject. Also remove incorrect module decrefs if module fails to initialise. (cherry picked from commit a87c9b538fbfc42883417c4d5e69f1a5922690e3) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* [3.10] gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE ↵Erlend Egeberg Aasland2022-06-081-9/+14
| | | | | (GH-93526) (GH-93599) (cherry picked from commit 875de61)
* gh-92839: fixed typo in _bisectmodule.c (line 131) (GH-92849) (#93321)Miss Islington (bot)2022-05-281-2/+2
|
* Fix NULL test in _testinternalcapi (GH-92861)Miss Islington (bot)2022-05-171-1/+1
| | | | | (cherry picked from commit 702e0da000bf28aa20cb7f3893b575d977506495) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582)Miss Islington (bot)2022-05-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `utc_to_seconds` call can fail, here's a minimal reproducer on Linux: TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)" The old behavior still raised an error in a similar way, but only because subsequent calculations happened to fail as well. Better to fail fast. This also refactors the tests to split out the `fromtimestamp` and `utcfromtimestamp` tests, and to get us closer to the actual desired limits of the functions. As part of this, we also changed the way we detect platforms where the same limits don't necessarily apply (e.g. Windows). As part of refactoring the tests to hit this condition explicitly (even though the user-facing behvior doesn't change in any way we plan to guarantee), I noticed that there was a difference in the places that `datetime.utcfromtimestamp` fails in the C and pure Python versions, which was fixed by skipping the "probe for fold" logic for UTC specifically — since UTC doesn't have any folds or gaps, we were never going to find a fold value anyway. This should prevent some failures in the pure python `utcfromtimestamp` method on timestamps close to 0001-01-01. There are two separate news entries for this because one is a potentially user-facing change, the other is an internal code correctness change that, if anything, changes some error messages. The two happen to be coupled because of the test refactoring, but they are probably best thought of as independent changes. Fixes GH-91581 (cherry picked from commit 83c0247d47b99f4571e35ea95361436e1d2a61cd) Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
* bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858)Itai Steinherz2022-05-101-1/+11
| | | | | | * [3.10] bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858). (cherry picked from commit 39e6b8ae6a5b49bb23746fdcc354d148ff2d98e3) Co-authored-by: Itai Steinherz <itaisteinherz@gmail.com>
* [3.10] gh-80254: Disallow recursive usage of cursors in `sqlite3` converters ↵Erlend Egeberg Aasland2022-05-051-14/+32
| | | | | | | | | | | | (#92274) * [3.10] gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054) (cherry picked from commit f629dcfe835e349433e4c5099381d668e8fe69c8) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Fix ref leak in pysqlite_cursor_iternext
* gh-92036: Fix gc_fini_untrack() (GH-92037)Miss Islington (bot)2022-05-041-0/+6
| | | | | | | | | | | Fix a crash in subinterpreters related to the garbage collector. When a subinterpreter is deleted, untrack all objects tracked by its GC. To prevent a crash in deallocator functions expecting objects to be tracked by the GC, leak a strong reference to these objects on purpose, so they are never deleted and their deallocator functions are not called. (cherry picked from commit 14243369b5f80613628a565c224bba7fb3fcacd8) Co-authored-by: Victor Stinner <vstinner@python.org>