Commit Graph

9 Commits

Author SHA1 Message Date
Enzo Bonnal a005835f69
gh-74028: add `buffersize` parameter to `concurrent.futures.Executor.map` for lazier behavior (#125663)
`concurrent.futures.Executor.map` now supports limiting the number of submitted
tasks whose results have not yet been yielded via the new `buffersize` parameter.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-13 11:57:53 +01:00
Sam Gross 776ec1e167
gh-110097: Fix flaky `test_timeout` in `test_concurrent_futures.test_process_pool` (gh-131108)
On heavily loaded systems, the launch of the workers to run
`time.sleep(0)` can take longer than the five second timeout.
2025-03-12 13:16:23 -04:00
Sam Gross 1908115871
gh-130957: Use `sleeping_retry` in `test_free_reference` (#130958)
The weak reference may not be immediately dead.
2025-03-11 09:51:26 -04:00
Eric Snow a5a7f5e16d
gh-124694: Add concurrent.futures.InterpreterPoolExecutor (gh-124548)
This is an implementation of InterpreterPoolExecutor that builds on ThreadPoolExecutor.

(Note that this is not tied to PEP 734, which is strictly about adding a new stdlib module.)

Possible future improvements:

* support passing a script for the initializer or to submit()
* support passing (most) arbitrary functions without pickling
* support passing closures
* optionally exec functions against __main__ instead of the their original module
2024-10-16 16:50:46 -06:00
Victor Stinner c608477532
gh-120417: Remove unused imports in tests (part 1) (#120629) 2024-06-17 21:05:56 +02:00
Sam Gross 520cf2170e
gh-117688: Fix deadlock in test_no_stale_references with GIL disabled (#117720)
Check `my_object_collected.wait()` in a loop to give the main thread a
chance to merge the reference count fields. Additionally, call
`my_object_collected.set()` in a background thread to avoid deadlocking
when the destructor is called asynchronously via the eval breaker
within the body of of `my_object_collected.wait()`.
2024-04-15 12:54:56 -04:00
Sam Gross a3af3cb4f4
gh-110481: Implement inter-thread queue for biased reference counting (#114824)
Biased reference counting maintains two refcount fields in each object:
`ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two
fields. In some cases, when refcounting operations are split across threads,
the ob_ref_shared field can be negative (although the total refcount must be
at least zero). In this case, the thread that decremented the refcount
requests that the owning thread give up ownership and merge the refcount
fields.
2024-02-09 17:08:32 -05:00
Serhiy Storchaka 1e0d62793a
gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) 2023-09-05 17:56:30 +03:00
Victor Stinner aa6f787faa
gh-108388: Convert test_concurrent_futures to package (#108401)
Convert test_concurrent_futures to a package of sub-tests.
2023-08-24 19:21:44 +02:00