summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is ↵Miss Islington (bot)2022-07-111-0/+14
| | | | | raised multiple times (GH-30274) (#94747) 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>
* gh-94321: Document sqlite3.PrepareProtocol (GH-94620)Miss Islington (bot)2022-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.11] gh-94510: Raise on re-entrant calls to sys.setprofile and ↵Łukasz Langa2022-07-051-1/+1
| | | | | | | | sys.settrace (GH-94511) (GH-94578) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 40d81fd63b46cf998880ce3bf3e5cb42bc3199c1)
* [3.11] gh-94404: Use module CFLAGS before PY_STDMODULE_CFLAGS (GH-94413) ↵Christian Heimes2022-06-291-3/+4
| | | | | | | (GH-94415) ``PY_STDMODULE_CFLAGS`` may contain include directories with system headers. This can break compiling with built-in libmpdec. Co-authored-by: Christian Heimes <christian@python.org>
* gh-94404: makesetup: use correct CFLAGS and macOS workaround (GH-94405)Miss Islington (bot)2022-06-291-5/+11
| | | | | | | ``makesetup`` now works around an issue with sed on macOS and uses correct CFLAGS for object files that end up in a shared extension. (cherry picked from commit 5150cbcd6821c0cf79b81cfc8780087bbc6985da) Co-authored-by: Christian Heimes <christian@python.org>
* 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.11] gh-90016: Reword sqlite3 adapter/converter docs (GH-93095) (#94272)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)
* gh-94207: Fix struct module leak (GH-94239) (GH-94265)Miss Islington (bot)2022-06-251-2/+20
| | | | | | | | | | | | | | 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 <mdickinson@enthought.com>
* gh-84461: Fix ctypes and test_ctypes on Emscripten (GH-94142)Miss Islington (bot)2022-06-241-1/+5
| | | | | | | | - c_longlong and c_longdouble need experimental WASM bigint. - Skip tests that need threading - Define ``CTYPES_MAX_ARGCOUNT`` for Emscripten. libffi-emscripten 2022-06-23 supports up to 1000 args. (cherry picked from commit 8625802d854ec0152177a6ff0ac092e0e3ff98a5) Co-authored-by: Christian Heimes <christian@python.org>
* Fix typo in _io.TextIOWrapper Clinic input (GH-94037) (GH-94116)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-94089)Miss Islington (bot)2022-06-222-2/+2
| | | | | (cherry picked from commit 0709586744ec58dd60492e16b08fff6dc1149a0a) Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
* gh-94028: Clear and reset sqlite3 statements properly in cursor iternext ↵Miss Islington (bot)2022-06-211-0/+3
| | | | | | | (GH-94042) (cherry picked from commit 94eeac03dc8c643ff050e7d0d306637d9556f798) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* gh-91985: Ensure in-tree builds override platstdlib_dir in every path ↵Miss Islington (bot)2022-06-201-1/+2
| | | | | | | calculation (GH-93641) (cherry picked from commit 38af903506e9b18c6350c1dadcb489f057713f36) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* gh-93937, C API: Move PyFrame_GetBack() to Python.h (#93938) (#94000)Victor Stinner2022-06-205-6/+0
| | | | | | | | | | | | | | | | | | Move the follow functions and type from frameobject.h to pyframe.h, so the standard <Python.h> provide frame getter functions: * PyFrame_Check() * PyFrame_GetBack() * PyFrame_GetBuiltins() * PyFrame_GetGenerator() * PyFrame_GetGlobals() * PyFrame_GetLasti() * PyFrame_GetLocals() * PyFrame_Type Remove #include "frameobject.h" from many C files. It's no longer needed. (cherry picked from commit 27b989403356ccdd47545a93aeab8434e9c69f21)
* gh-84461: Silence some compiler warnings on WASM (GH-93978)Miss Islington (bot)2022-06-204-5/+9
| | | | | (cherry picked from commit 774ef28814d0d9d57ec813cb31b0a7af6c476127) Co-authored-by: Christian Heimes <christian@python.org>
* gh-93925: Improve clarity of sqlite3 commit/rollback, and close docs (GH-93926)Miss Islington (bot)2022-06-192-10/+22
| | | | | | Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> (cherry picked from commit 6446592c89b0c581c00e170ae6278291e940755c) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* gh-91404: Revert "bpo-23689: re module, fix memory leak when a match is ↵Miss Islington (bot)2022-06-175-81/+47
| | | | | | | | | | | | | | | terminated by a signal or allocation failure (GH-32283) (GH-93882) Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)" This reverts commit 6e3eee5c11b539e9aab39cff783acf57838c355a. Manual fixups to increase the MAGIC number and to handle conflicts with a couple of changes that landed after that. Thanks for reviews by Ma Lin and Serhiy Storchaka. (cherry picked from commit 4beee0c7b0c2cc78a893dde88fd8e34099dcf877) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.11] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93800)Erlend Egeberg Aasland2022-06-141-74/+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) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* 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: Allow _winapi.LCMapStringEx to handle embedded nulls (GH-93688)Steve Dower2022-06-101-4/+10
|
* [3.11] gh-90763: Modernise xx template module initialisation (GH-93078) (#93681)Erlend Egeberg Aasland2022-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>
* bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for ↵Steve Dower2022-06-102-1/+112
| | | | | | | | | case-folding (GH-93591) * bpo-42658: Use LCMapStringEx in ntpath.normcase to match OS behaviour for case-folding (GH-32010) * Use AsWideCharString to avoid memory leaks in deprectated unicode converter Co-authored-by: AN Long <aisk@users.noreply.github.com>
* gh-92434: Silence compiler warning in Modules/_sqlite/connection.c on 32-bit ↵Miss Islington (bot)2022-06-101-1/+1
| | | | | | | systems (GH-93090) (cherry picked from commit d8395eb38d3d05f74a7f348da81a280ad272b8c8) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (GH-93526)Miss Islington (bot)2022-06-081-8/+11
| | | | | (cherry picked from commit 875de61c296604f3a3a51e9d76355e0f1a24c6af) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534) (GH-93550)Miss Islington (bot)2022-06-061-0/+4
| | | | | | WASI does not have the ``chmod(2)`` syscall yet. (cherry picked from commit 22fed605e096eb74f3aa33f6d25aee76fdc2a3fa) Co-authored-by: Christian Heimes <christian@python.org>
* gh-69093: Fix Setup.local.in rule for _sqlite3 (GH-93380)Miss Islington (bot)2022-05-311-1/+1
| | | | | (cherry picked from commit 8a5e3c2ec6254b2ce06d17545f58a6719e0c8fdb) Co-authored-by: Christian Heimes <christian@python.org>
* gh-92839: fixed typo in _bisectmodule.c (line 131) (GH-92849)Miss Islington (bot)2022-05-281-2/+2
| | | | | (cherry picked from commit 7fa9b7daa5a8bb5760724ac2d94f5298c60dc905) Co-authored-by: oda-gitso <105083118+oda-gitso@users.noreply.github.com>
* [3.11] bpo-40514: Drop EXPERIMENTAL_ISOLATED_SUBINTERPRETERS (gh-93185) ↵Eric Snow2022-05-282-23/+0
| | | | | | | | | | | | | (GH-93306) (cherry picked from commit caa279d6fd5f151e57f891cd4f6ba51b532501c6) This was added for bpo-40514 (gh-84694) to test out a per-interpreter GIL. However, it has since proven unnecessary to keep the experiment in the repo. (It can be done as a branch in a fork like normal.) So here we are removing: * the configure option * the macro * the code enabled by the macro Automerge-Triggered-By: GH:ericsnowcurrently
* gh-92728: Restore re.template, but deprecate it (GH-93161)Miss Islington (bot)2022-05-252-0/+2
| | | | | | | | Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)" This reverts commit b09184bf05b07b77c5ecfedd4daa846be3cbf0a9. (cherry picked from commit 16a7e4a0b75080275bf12cfb71d54b01d85099b2) Co-authored-by: Miro Hrončok <miro@hroncok.cz>
* [3.11] gh-93044: No longer convert the database argument of ↵Serhiy Storchaka2022-05-212-7/+4
| | | | | | | | sqlite3.connect() to bytes (GH-93046) (GH-93048) Just pass it to the factory as is. (cherry picked from commit 14c0d33016a967a98155f2e1615660e9328aef5d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91922: Fix sqlite connection on nonstardard locales and paths (GH-92926)Miss Islington (bot)2022-05-202-53/+20
| | | | | (cherry picked from commit d8537580921b2e02f477ff1a8dedcf82c24ef0c2) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-92913: Clarify changes to PyInitConfig.module_search_paths[_set] fields ↵Miss Islington (bot)2022-05-191-2/+3
| | | | | | | (GH-92980) (cherry picked from commit 403d16fa28764718dcd0536ccb3ab8d05768465d) Co-authored-by: Steve Dower <steve.dower@python.org>
* gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Miss Islington (bot)2022-05-191-1/+1
| | | | | (cherry picked from commit 137fd3d88aa46669f5717734e823f4c594ab2843) Co-authored-by: Christian Heimes <christian@python.org>
* Fix NULL check in test_type_from_ephemeral_spec in_testcapimodule.c (GH-92863)Miss Islington (bot)2022-05-171-1/+1
| | | | | (cherry picked from commit 524f03c08ca6688785c0fe99d8f2b385bf92e58f) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
* 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>
* GH-92236: Remove spurious "line" event when starting coroutine or generator. ↵Miss Islington (bot)2022-05-131-0/+46
| | | | | | (GH-92722) (GH-92772) (cherry picked from commit 22a1db378c5c381272362c5b2f68ac78a368e136)
* gh-92356: Fix regression in ctypes function call overhead (#92357)Michael Droettboom2022-05-061-0/+1
| | | | | | 38f331d introduced a delayed initialization routine to set up ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently removed setting the `initialization` flag to 1 to avoid initting each time.
* gh-80010: Expand fromisoformat to include most of ISO-8601 (#92177)Paul Ganssle2022-05-061-71/+288
| | | This expands `fromisoformat` to cover most of the common uses of ISO 8601. We may expand the scope more in the future.
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-052-1/+2
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* gh-82616: Add process_group support to subprocess.Popen (#23930)Gregory P. Smith2022-05-051-7/+13
| | | | | | | | One more thing that can help prevent people from using `preexec_fn`. Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related. Co-authored-by: Zackery Spytz <zspytz@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-92345: Import rlcompleter before sys.path is extended (#92346)Christian Heimes2022-05-051-1/+10
| | | | | | | | | | ``pymain_run_python()`` now imports ``readline`` and ``rlcompleter`` before sys.path is extended to include the current working directory of an interactive interpreter. Non-interactive interpreters are not affected. Also move imports of ``re`` and ``keyword`` module to top level so they are materialized early, too. The ``keyword`` module is trivial and the ``re`` is already imported via ``inspect`` -> ``linecache``.
* gh-92301: subprocess: Prefer close_range() to procfs-based fd closing (#92303)Alexey Izbyshev2022-05-051-18/+70
| | | | | | | | #92301: subprocess: Prefer `close_range()` to procfs-based fd closing. `close_range()` is much faster for large number of file descriptors, e.g. 4 times faster for 1000 descriptors in a Linux 5.16-based environment. We prefer close_range() only if it's known to be async-signal-safe.
* bpo-41818: Add os.login_tty() for *nix. (#29658)Soumendra Ganguly2022-05-052-10/+100
| | | | | | * Add `os.login_tty(fd)` for Unix. Reviewed-by: Christian Heimes <christian@python.org> Signed-off-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* GH-92239: Make sure that PEP 523 is supported, even when specializing first. ↵Mark Shannon2022-05-041-1/+36
| | | | (GH-92245)
* gh-92210: Move socket.__init__ to argument clinic (#92237)Joshua Herman2022-05-042-14/+91
| | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>