Commit graph

122494 commits

Author SHA1 Message Date
Victor Stinner 90b7540526
gh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228)
Don't hardcode 'dest' in HAVE_SUBOFFSETS_IN_LAST_DIM() macro of
memoryobject.c, but use its 'view' parameter instead.

Fix the Coverity issue:

Error: COPY_PASTE_ERROR (CWE-398):
Python-3.12.2/Objects/memoryobject.c:273:14: original: ""dest->suboffsets + (dest->ndim - 1)"" looks like the original copy.
Python-3.12.2/Objects/memoryobject.c:274:14: copy_paste_error: ""dest"" in ""src->suboffsets + (dest->ndim - 1)"" looks like a copy-paste error.
Python-3.12.2/Objects/memoryobject.c:274:14: remediation: Should it say ""src"" instead?
#  272|       assert(dest->ndim > 0 && src->ndim > 0);
#  273|       return (!HAVE_SUBOFFSETS_IN_LAST_DIM(dest) &&
#  274|->             !HAVE_SUBOFFSETS_IN_LAST_DIM(src) &&
#  275|               dest->strides[dest->ndim-1] == dest->itemsize &&
#  276|               src->strides[src->ndim-1] == src->itemsize);
2024-06-07 17:58:21 +02:00
Xi Ruoyao a758424566
gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (#120227)
The worst case is that the kernel buffers 17 pages with a page size of 64k.
2024-06-07 08:51:32 -07:00
Nikita Sobolev 10fb1b8f36
gh-120200: Fix inspect.iscoroutinefunction(inspect) is True corner case (#120214) 2024-06-07 18:48:31 +03:00
Pieter Eendebak 9d6604222e
gh-114264: Optimize performance of copy.deepcopy by adding a fast path for atomic types (GH-114266) 2024-06-07 18:42:01 +03:00
Erlend E. Aasland 225aab7f70
gh-110383: Improve 'old string formatting' text in tutorial (#120219) 2024-06-07 15:37:18 +02:00
Irit Katriel eca3f7762c
gh-93691: fix too broad source locations of with-statement instructions (#120125) 2024-06-07 14:06:24 +01:00
Serhiy Storchaka d68a22e7a6
gh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213)
* Use new methods for tracing Tcl variable.
* Fix Combobox.current() for empty combobox.
2024-06-07 10:49:07 +00:00
Aditya Borikar 6646a9da26
gh-110383: Clarify "non-integral" wording in pow() docs (#119688) 2024-06-07 11:44:42 +02:00
Kirill Podoprigora d5ba4fc9bc
gh-120164: Fix test_os.test_win32_mkdir_700() (#120177)
Don't compare the path to avoid encoding issues.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2024-06-07 11:14:13 +02:00
Michael Allwright 47816f465e
gh-120154: Fix Emscripten/WASI pattern in case statement for LDSHARED (#120173)
Fix Emscripten/WASI pattern in case statement for LDSHARED
2024-06-07 10:38:15 +02:00
Xie Yanbo 6a97929a5a
Fix typos in comments (#120188) 2024-06-07 10:19:41 +02:00
Kirill Podoprigora 57ad769076
gh-120080: Accept `None as a valid argument for direct call of the int.__round__` (#120088)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-07 10:03:28 +02:00
Clinton bd826b9c77
gh-120157: Remove unused code in concurrent.future (gh-120187) 2024-06-07 16:39:19 +09:00
Hugo van Kemenade 5c115567b1
Add Plausible for docs metrics (#119977)
Co-authored-by: Julien Palard <julien@palard.fr>
2024-06-07 00:38:31 -06:00
Jacob Walls 6b606522ca
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)
Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.
2024-06-06 20:18:30 -07:00
Barney Gale 14e1506a6d
GH-119054: Add "Reading directories" section to pathlib docs (#119956)
Add a dedicated subsection for `Path.iterdir()`-related methods,
specifically `iterdir()`, `glob()`, `rglob()` and `walk()`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-06 23:27:39 +00:00
David Lowry-Duda 5bdc87b885
gh-120178: Documentation typo corrections (#120179) 2024-06-06 14:35:24 -07:00
Sam Gross e21057b999
gh-117657: Fix TSAN race involving import lock (#118523)
This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
2024-06-06 13:40:58 -04:00
Tian Gao 417bec733c
Add Tian Gao to CODEOWNERS and ACKS (GH-120166) 2024-06-06 10:20:37 -07:00
Serhiy Storchaka 2d7ff6e0e7
Restore decimal context after decimal doctests (GH-120149)
The modified context caused tests failures in several other tests.
2024-06-06 20:12:32 +03:00
Jelle Zijlstra d50a7c478f
CODEOWNERS: Add myself to symtable and AST (#120139)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-06-06 16:25:05 +00:00
Victor Stinner 78634cfa3d
gh-120155: Initialize variables in _tkinter.c (#120156)
Initialize variables in _tkinter.c to make static analyzers happy.
2024-06-06 17:31:33 +02:00
Steve Dower cccc9f63c6
gh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script (GH-120133) 2024-06-06 16:11:42 +01:00
Nice Zombies fd104dfcb8
gh-120111: Don't use cirrus M1 macOS runners on fork (#120116)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-06 13:40:37 +02:00
Irit Katriel eeb8f67f83
gh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137) 2024-06-06 10:56:58 +00:00
Jan Kaliszewski f878d46e56
gh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)
The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).
2024-06-06 00:52:40 +03:00
Barney Gale e83ce850f4
pathlib ABCs: remove duplicate realpath() implementation. (#119178)
Add private `posixpath._realpath()` function, which is a generic version of `realpath()` that can be parameterised with string tokens (`sep`, `curdir`, `pardir`) and query functions (`getcwd`, `lstat`, `readlink`). Also add support for limiting the number of symlink traversals.

In the private `pathlib._abc.PathBase` class, call `posixpath._realpath()` and remove our re-implementation of the same algorithm.

No change to any public APIs, either in `posixpath` or `pathlib`.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-05 18:54:50 +01:00
benchatt 14e3c7071b
gh-115225: Raise error on unsupported ISO 8601 time strings (#119339)
Some time strings that contain fractional hours or minutes are permitted
by ISO 8601, but such strings are very unlikely to be intentional. The
current parser does not parse such strings correctly or raise an error.
This change raises a ValueError when hours or minutes contain a decimal mark.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-06-05 13:35:40 -04:00
Irit Katriel 10eac0269b
gh-119786: add links to code in exception handling doc (#120077) 2024-06-05 16:28:47 +01:00
Sam Gross 4bba1c9e6c
gh-120065: Increase collect_in_thread period to 5 ms. (#120068)
This matches the default GIL switch interval. It greatly speeds up the
free-threaded build: previously, it spent nearly all its time in
`gc.collect()`.
2024-06-05 09:23:29 -04:00
Irit Katriel 5c02ea8bae
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (#119657) 2024-06-05 11:56:01 +00:00
Vinay Sajip 983efcf15b
gh-119819: Update logging configuration to support joinable multiproc… (GH-120090)
gh-119819: Update logging configuration to support joinable multiprocessing manager queues.
2024-06-05 07:25:47 +01:00
shurj0 b6b0dcbfc0
gh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH-120081) 2024-06-04 19:23:12 -05:00
Irit Katriel 770f3c1ead
gh-114616: Improve docs regarding changes to caches representation in dis (#120033) 2024-06-04 23:00:02 +00:00
Lysandros Nikolaou 69b3e8ea56
gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075) 2024-06-04 23:22:28 +02:00
Sam Gross 4055577221
gh-119999: Fix potential race condition in _Py_ExplicitMergeRefcount (#120000)
We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`.
Once we mark `ob_ref_shared` as merged, some other thread may free the
object because the caller also passes in `-1` as `extra` to give up its
only reference.
2024-06-04 15:26:26 -04:00
Vinay Sajip 109e1082ea
gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067) 2024-06-04 20:16:43 +01:00
Sam Gross 710cbea660
gh-120048: Make test_imaplib faster (#120050)
The `test_imaplib` was taking 40+ minutes in the refleak build bots because
the tests waiting on a client `self._setup()` was creating a client that
prevented progress until its connection timed out, which scaled with the
global timeout.

We should set `connect=False` for the tests that don't want `_setup()` to
create a client.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-04 14:59:23 -04:00
Pablo Galindo Salgado d9095194dd
gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-06-04 20:32:43 +02:00
Paulo Freitas bf5e1065f4
doc: Mention the missing reflected special methods for all binary operations (GH-119931) 2024-06-04 17:55:11 +00:00
Lysandros Nikolaou 010ea93b2b
gh-119553: Clear reader on Ctrl-C command (GH-119801) 2024-06-04 19:46:33 +02:00
Sam Gross d419d468ff
gh-120039: Reduce expected timeout in test_siginterrupt_off (#120047)
The process is expected to time out. In the refleak builds,
`support.SHORT_TIMEOUT` is often five minutes and we run the tests six
times, so test_signal was taking >30 minutes.
2024-06-04 17:38:29 +00:00
Lysandros Nikolaou bf8e5e53d0
gh-120041: Refactor check for visible completion menu in completing_reader (#120055) 2024-06-04 19:26:44 +02:00
Christopher Chavez e079935282
gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)
* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-04 19:47:15 +03:00
Serhiy Storchaka 7111d9605f
gh-89928: Fix integer conversion of device numbers (GH-31794)
Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).
2024-06-04 19:36:37 +03:00
Trey Hunner 5f03f09134
Fix incorrect pull GitHub link in What's New (#120045)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-04 16:28:08 +00:00
Lysandros Nikolaou 8fc7653766
gh-120041: Do not use append_to_screen when completions are visible (GH-120042) 2024-06-04 18:09:31 +02:00
Jason R. Coombs 4dcd91ceaf
gh-119588: Update docs to reflect decision to include the change with Python 3.13 and not 3.12. (#120043) 2024-06-04 15:20:01 +00:00
Bénédikt Tran ff1857d6ed
gh-120029: export DEF_TYPE_PARAM compiler flag (#120028) 2024-06-04 07:24:22 -07:00
Sam Gross e69d068ad0
gh-117657: Fix race involving GC and heap initialization (#119923)
The `_PyThreadState_Bind()` function is called before the first
`PyEval_AcquireThread()` so it's not synchronized with the stop the
world GC. We had a race where `gc_visit_heaps()` might visit a thread's
heap while it's being initialized.

Use a simple atomic int to avoid visiting heaps for threads that are not
yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called).

The race was reproducible by running:
`python Lib/test/test_importlib/partial/pool_in_threads.py`.
2024-06-04 09:42:13 -04:00