Commit Graph

122466 Commits

Author SHA1 Message Date
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
Mark Jason Dominus (陶敏修) bd8c1f97e1
gh-94808: Reorganize _make_posargs and mark unused code (GH-119227)
* Reorganize four-way if-elsif-elsif-elsif as nested if-elses
* Mark unused branch in _make_posargs

`names_with_default` is never `NULL`, even if there are no names with
defaults.  In that case it points to a structure with `size` zero.

Rather than eliminating the branch, we leave it behind with an `assert(0)`
in case a future change to the grammar exercises the branch.
2024-06-04 14:59:56 +02:00
Vinay Sajip 99d945c0c0
gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030) 2024-06-04 13:20:50 +01:00
Kaundur dce14bb2dc
gh-118868: logging QueueHandler fix passing of kwargs (GH-118869)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-06-04 12:48:05 +01:00
Xie Yanbo 9e052619a6
Fix typos in documentation and comments (#119763) 2024-06-04 10:22:22 +00:00
Victor Stinner 5a1205b641
gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)
Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before
the interpreter is deleted.
2024-06-04 11:39:07 +02:00
Victor Stinner 26e5c6e835
gh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)
Use directly memcpy() instead.
2024-06-04 09:23:55 +00:00
Steve Dower 5c48eb0cc6
gh-119070: Update test_shebang_executable_extension to always use non-installed version (GH-119846) 2024-06-04 10:17:45 +02:00
d.grigonis a8f1152b70
gh-119879: str.find(): Utilize last character gap for two-way periodic needles (#119880) 2024-06-04 03:44:49 -04:00
Jason R. Coombs 8d63c8d47b
gh-106531: Apply changes from importlib_resources 6.3.2 (#117054)
Apply changes from importlib_resources 6.3.2.
2024-06-04 06:36:28 +00:00
Petr Viktorin 31a4fb3c74
gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513)" (#119974)
This reverts commit 1c8f912ebd.
2024-06-03 18:10:15 -07:00
Eric Snow 105f22ea46
gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)
We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

The relevant code could use some cleanup but I opted to avoid the significant churn in this change.  I'll tackle that separately.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.
2024-06-03 17:09:18 -06:00
Eric Snow dba7a167db
gh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)
This makes the support official.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-03 16:42:48 -06:00
Eric Snow d82a7ba041
gh-117398: Add datetime Module State (gh-119810)
I was able to make use of the existing datetime_state struct, but there was one tricky thing I had to sort out.  We mostly aren't converting to heap types, so we can't use things like PyType_GetModuleByDef() to look up the module state.  The solution I came up with is somewhat novel, but I consider it straightforward.  Also, it shouldn't have much impact on performance.

In summary, this main changes here are:

* I've added some macros to help hide how various objects relate to module state
* as a solution to the module state lookup problem, I've stored the last loaded module on the current interpreter's internal dict (actually a weakref)
* if the static type method is used after the module has been deleted, it is reloaded
* to avoid extra work when loading the module, we directly copy the objects (new refs only) from the old module state into the new state if the old module hasn't been deleted yet
* during module init we set various objects on the static types' __dict__s; to simplify things, we only do that the first time; once those static types have a separate __dict__ per interpreter, we'll do it every time
* we now clear the module state when the module is destroyed (before, we were leaking everything in _datetime_global_state)
2024-06-03 15:56:00 -06:00
Sam Gross 47fb4327b5
gh-117657: Fix race involving immortalizing objects (#119927)
The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.

This fixes a race condition involving the tracking of whether the
behavior is suppressed.
2024-06-03 20:58:41 +00:00
Irit Katriel b8fde5db86
update CODEOWNERS (#120003) 2024-06-03 20:44:36 +00:00
Sam Gross 41c1cefbae
gh-117657: Avoid `sem_clockwait` in TSAN (#119915)
The `sem_clockwait` function is not currently instrumented, which leads
to false positives.
2024-06-03 13:42:27 -04:00
Daniel Hollas 2e0aa731ae
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (#119942) 2024-06-03 18:07:06 +01:00
Victor Stinner 4e8aa32245
gh-119727: Add --single-process option to regrtest (#119728) 2024-06-03 16:34:36 +00:00
Nikita Sobolev 1d4c2e4a87
gh-119057: Use better error messages for zero division (#119066) 2024-06-03 19:03:56 +03:00
Bénédikt Tran 153b118b78
gh-119981: Use do while(0) in some symtable.c multi-line macros (#119982) 2024-06-03 15:48:02 +00:00
Łukasz Langa 6acb32fac3
Use Cirrus M1 macOS runners for CI (GH-119979)
Co-authored-by: Ee Durbin <ee@python.org>
2024-06-03 17:32:40 +02:00
Jason R. Coombs 42a34ddb0b
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591) 2024-06-03 11:13:07 -04:00
Steve Dower fd01271366
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790) 2024-06-03 15:42:45 +01:00
Nice Zombies 4765e1fa29
gh-102511: Amend 3.13.0b1.rst (GH-119895) 2024-06-03 14:27:44 +01:00
Sergey B Kirpichev 61d3ab32da
gh-116560: Add PyLong_GetSign() public function (#116561)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-03 14:06:31 +02:00
Irit Katriel 367adc91fb
gh-119786: move exception handling doc to InternalDocs (#119815) 2024-06-03 09:36:20 +00:00
Awbert cae4c80714
gh-119968: Improved monitoring c-api docs (#119969) 2024-06-03 12:31:02 +03:00
Serhiy Storchaka d7fcaa73b7
gh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex (GH-119839) 2024-06-03 12:29:01 +03:00