# \#asyncio

**URL:** https://discuss.python.org/tag/asyncio/43.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [Deprecate the iterator interface of async generator \`asend\`/\`athrow\` objects](https://discuss.python.org/t/deprecate-the-iterator-interface-of-async-generator-asend-athrow-objects/109137)

<div class="topic-metadata">

**Author:** [@kumaraditya303](https://discuss.python.org/u/kumaraditya303)\
**Replies:** 4\
**Last updated:** [September 19, 2026, 8:04pm UTC](https://discuss.python.org/t/deprecate-the-iterator-interface-of-async-generator-asend-athrow-objects/109137 "2026-09-19T20:04:44Z")

</div>

I propose to deprecate \_\_iter\_\_ and \_\_next\_\_ on the async\_generator\_asend and async\_generator\_athrow types, leaving them with \_\_await\_\_, send, throw and close like coroutines as described in PEP 525. The motivation is…

---

## [Semaphores for use with both threads and asyncio?](https://discuss.python.org/t/semaphores-for-use-with-both-threads-and-asyncio/109055)

<div class="topic-metadata">

**Author:** [@brittanyrey](https://discuss.python.org/u/brittanyrey)\
**Replies:** 4\
**Last updated:** [September 15, 2026, 1:31am UTC](https://discuss.python.org/t/semaphores-for-use-with-both-threads-and-asyncio/109055 "2026-09-15T01:31:38Z")

</div>

Hi! I’m currently adopting a program to use FT Python and went down a bit of a rabbit hole. The code bounds a shared resource with a semaphore, acquired from inside an asyncio event loop. With free threading, the code m…

---

## [Unified Concurrency Interface](https://discuss.python.org/t/unified-concurrency-interface/108763)

<div class="topic-metadata">

**Author:** [@AngellusMortis](https://discuss.python.org/u/AngellusMortis)\
**Replies:** 6\
**Last updated:** [August 26, 2026, 8:08pm UTC](https://discuss.python.org/t/unified-concurrency-interface/108763 "2026-08-26T20:08:07Z")

</div>

From my experience working on asyncio code and sync/non-asyncio code, probablythe most annoying part is actually building interfaces that support both. You get a bunch of aget or async\_get verus get calls. Async adapters…

---

## [A need for asyncio StreamWrite.awrite](https://discuss.python.org/t/a-need-for-asyncio-streamwrite-awrite/108302)

<div class="topic-metadata">

**Author:** [@dpgeorge](https://discuss.python.org/u/dpgeorge)\
**Replies:** 1\
**Last updated:** [July 28, 2026, 7:34am UTC](https://discuss.python.org/t/a-need-for-asyncio-streamwrite-awrite/108302 "2026-07-28T07:34:59Z")

</div>

A long time ago (September 2018) asyncio’s StreamWriter class gained awrite(data) and aclose() async methods. See But they never made it into a release and awrite() was merged into write() which became a hybrid sync/…

---

## [An eager way to set\_result on asyncio.Future?](https://discuss.python.org/t/an-eager-way-to-set-result-on-asyncio-future/106161)

<div class="topic-metadata">

**Author:** [@tarasko](https://discuss.python.org/u/tarasko)\
**Replies:** 28\
**Last updated:** [February 24, 2026, 8:55am UTC](https://discuss.python.org/t/an-eager-way-to-set-result-on-asyncio-future/106161 "2026-02-24T08:55:45Z")

</div>

When I set\_result on a Future that is awaited by some coroutine it doesn’t immediately wake up the coroutine. Instead all Future callbacks are scheduled using loop.call\_soon. Would it be possible to add some kind of Fut…

---

## [Overcome \*PoolExecutor class dangers](https://discuss.python.org/t/overcome-poolexecutor-class-dangers/106133)

<div class="topic-metadata">

**Author:** [@davidmcnabnz](https://discuss.python.org/u/davidmcnabnz)\
**Replies:** 3\
**Last updated:** [February 12, 2026, 6:54pm UTC](https://discuss.python.org/t/overcome-poolexecutor-class-dangers/106133 "2026-02-12T18:54:08Z")

</div>

In their present form, the \*PoolExecutor classes can be dangerous in high-pressure production environments, if used purely as documented. (For example, library calls in an asyncio environment which \[in\]directly cause DN…

---

## [Adding a low level wait for file descriptor](https://discuss.python.org/t/adding-a-low-level-wait-for-file-descriptor/51442)

<div class="topic-metadata">

**Author:** [@pcauchon](https://discuss.python.org/u/pcauchon)\
**Replies:** 2\
**Last updated:** [February 12, 2026, 5:04am UTC](https://discuss.python.org/t/adding-a-low-level-wait-for-file-descriptor/51442 "2026-02-12T05:04:23Z")

</div>

I had to integrate using asyncio a blocking library that uses sockets. Typical use case: async def handler(fd): loop = asyncio.get\_running\_loop() while True: await loop.wait\_readable(fd) x = blo…

---

## [Understanding asyncio.subprocess.Process garbage collection](https://discuss.python.org/t/understanding-asyncio-subprocess-process-garbage-collection/105973)

<div class="topic-metadata">

**Author:** [@eike](https://discuss.python.org/u/eike)\
**Replies:** 11\
**Last updated:** [February 3, 2026, 6:24pm UTC](https://discuss.python.org/t/understanding-asyncio-subprocess-process-garbage-collection/105973 "2026-02-03T18:24:47Z")

</div>

The documentation on asyncio.create\_subprocess\_exec claims: If the process object is garbage collected while the process is still running, the child process will be killed. However, I cannot get this to work. For exa…

---

## [How to cancel all tasks created within same TaskGroup](https://discuss.python.org/t/how-to-cancel-all-tasks-created-within-same-taskgroup/30215)

<div class="topic-metadata">

**Author:** [@JoakimJoensuu](https://discuss.python.org/u/JoakimJoensuu)\
**Replies:** 14\
**Last updated:** [December 8, 2025, 1:23am UTC](https://discuss.python.org/t/how-to-cancel-all-tasks-created-within-same-taskgroup/30215 "2025-12-08T01:23:12Z")

</div>

TaskGroup is quite new thing and I didn’t find functionality for easily cancelling all other tasks that might be running in the same task group. Only method TaskGroup object has is create\_task. Is this the right way to …

---

## [Test\_asyncio\_run\_without\_uncancel stuck in run\_forever(base\_events) asyncio loop](https://discuss.python.org/t/test-asyncio-run-without-uncancel-stuck-in-run-forever-base-events-asyncio-loop/104745)

<div class="topic-metadata">

**Author:** [@zuhu2195](https://discuss.python.org/u/zuhu2195)\
**Replies:** 1\
**Last updated:** [November 9, 2025, 12:51am UTC](https://discuss.python.org/t/test-asyncio-run-without-uncancel-stuck-in-run-forever-base-events-asyncio-loop/104745 "2025-11-09T00:51:14Z")

</div>

Hi, I am seeing the above test case test\_asyncio\_run\_without\_uncancel continuously running in run\_forever. The program runs fine when I try to place the breakpoint or when I add even a print statement, however it gets …

---

## [Why might asyncio.get\_running\_loop fail to find an extant event loop?](https://discuss.python.org/t/why-might-asyncio-get-running-loop-fail-to-find-an-extant-event-loop/104491)

<div class="topic-metadata">

**Author:** [@cookiedoughicecream](https://discuss.python.org/u/cookiedoughicecream)\
**Replies:** 3\
**Last updated:** [October 30, 2025, 8:07pm UTC](https://discuss.python.org/t/why-might-asyncio-get-running-loop-fail-to-find-an-extant-event-loop/104491 "2025-10-30T20:07:18Z")

</div>

(Apologies in advance if Python Help is the wrong forum, I wasn’t sure if I should post here or in Async-SIG.) In an API I’m working on, we are adding in statistics on registered webhooks so consumers can check the heal…

---

## [Is it ok to use async \_\_new\_\_?](https://discuss.python.org/t/is-it-ok-to-use-async-new/104579)

<div class="topic-metadata">

**Author:** [@rsdenijs](https://discuss.python.org/u/rsdenijs)\
**Replies:** 8\
**Last updated:** [October 28, 2025, 6:50pm UTC](https://discuss.python.org/t/is-it-ok-to-use-async-new/104579 "2025-10-28T18:50:56Z")

</div>

This example runs and linters don’t complain. Other than it being unexpected for a class constructor to behave like an async generator, is there anything fundamentally wrong here? import asyncio from collections.abc im…

---

## [Asyncio RLock - reentrant locks for async Python](https://discuss.python.org/t/asyncio-rlock-reentrant-locks-for-async-python/21509)

<div class="topic-metadata">

**Author:** [@robsdedude](https://discuss.python.org/u/robsdedude)\
**Replies:** 12\
**Last updated:** [October 22, 2025, 9:11pm UTC](https://discuss.python.org/t/asyncio-rlock-reentrant-locks-for-async-python/21509 "2025-10-22T21:11:02Z")

</div>

I’d like to re-open the discussion started here https://github.com/python/asyncio/issues/439, which requested reentrant locks to be added to asyncio. GvR argues that locks in eventloop-based concurrency are less used be…

---

## [Support async contextmanagers in contextlib.suppress](https://discuss.python.org/t/support-async-contextmanagers-in-contextlib-suppress/103954)

<div class="topic-metadata">

**Author:** [@PabloRuizCuevas](https://discuss.python.org/u/PabloRuizCuevas)\
**Replies:** 9\
**Last updated:** [September 30, 2025, 2:47am UTC](https://discuss.python.org/t/support-async-contextmanagers-in-contextlib-suppress/103954 "2025-09-30T02:47:21Z")

</div>

Now that Python supports chaining multiple context managers with a single with or async with statement, I think that it would be nice if contextlib.suppress would also support both sync and async context managers. from…

---

## [Add non-\`async\` \`try\_acquire\` method to \`asyncio.Lock\` to attempt locking immedietly from normal functions](https://discuss.python.org/t/add-non-async-try-acquire-method-to-asyncio-lock-to-attempt-locking-immedietly-from-normal-functions/102583)

<div class="topic-metadata">

**Author:** [@MaPePeR](https://discuss.python.org/u/MaPePeR)\
**Replies:** 7\
**Last updated:** [August 17, 2025, 1:53pm UTC](https://discuss.python.org/t/add-non-async-try-acquire-method-to-asyncio-lock-to-attempt-locking-immedietly-from-normal-functions/102583 "2025-08-17T13:53:16Z")

</div>

The asyncio.Lock class only provides an async def acquire() method, but because it is async its very hard to acquire the lock from a normal function, because acquire only locks when it is awaited, which is only possible …

---

## [Public proactor API?](https://discuss.python.org/t/public-proactor-api/102183)

<div class="topic-metadata">

**Author:** [@James\_E](https://discuss.python.org/u/James_E)\
**Replies:** 0\
**Last updated:** [August 12, 2025, 10:52pm UTC](https://discuss.python.org/t/public-proactor-api/102183 "2025-08-12T22:52:10Z")

</div>

Is there any access to the IOCP wait\_for\_handle functionality without going through the ugliness violation of an access to loop.\_proactor? I couldn’t find any calls to it in the main codebase outside of very tightly coup…

---

## [Error retrieving tasks: Failed to find the PyRuntime section in process 9026 on macOS platform (tried both libpython and python), while trying asyncio ps](https://discuss.python.org/t/error-retrieving-tasks-failed-to-find-the-pyruntime-section-in-process-9026-on-macos-platform-tried-both-libpython-and-python-while-trying-asyncio-ps/100311)

<div class="topic-metadata">

**Author:** [@cbuh](https://discuss.python.org/u/cbuh)\
**Replies:** 7\
**Last updated:** [August 1, 2025, 10:57am UTC](https://discuss.python.org/t/error-retrieving-tasks-failed-to-find-the-pyruntime-section-in-process-9026-on-macos-platform-tried-both-libpython-and-python-while-trying-asyncio-ps/100311 "2025-08-01T10:57:52Z")

</div>

Hello, I was following the example from What’s new in Python 3.14 — Python 3.14.0rc1 documentation and it failed with this error: aleksandrvin@Mac python-playground % sudo uv run python -m asyncio ps 9026 Error retriev…

---

## [Improve the context of asyncio slow log reporting](https://discuss.python.org/t/improve-the-context-of-asyncio-slow-log-reporting/83225)

<div class="topic-metadata">

**Author:** [@msukmanowsky](https://discuss.python.org/u/msukmanowsky)\
**Replies:** 1\
**Last updated:** [March 5, 2025, 6:33pm UTC](https://discuss.python.org/t/improve-the-context-of-asyncio-slow-log-reporting/83225 "2025-03-05T18:33:19Z")

</div>

Hi all, Wanted to kick off a discussion for an improvement to CPython and asyncio that I view as critical to enabling debugging for server environments. My issue is this: when debug mode is enabled for the Python event…

---

## [Add task pipeline to asyncio with capped parallelism and lazy input reading](https://discuss.python.org/t/add-task-pipeline-to-asyncio-with-capped-parallelism-and-lazy-input-reading/79292)

<div class="topic-metadata">

**Author:** [@missing-stardust](https://discuss.python.org/u/missing-stardust)\
**Replies:** 25\
**Last updated:** [February 15, 2025, 8:51am UTC](https://discuss.python.org/t/add-task-pipeline-to-asyncio-with-capped-parallelism-and-lazy-input-reading/79292 "2025-02-15T08:51:19Z")

</div>

Motivation I would like to propose adding a standard way to implement async data processing pipelines that are memory-friendly, enable input data stream being generated lazily or dynamically, and enable easy capping of p…

---

## [Add \`asyncio.console\` module to progamatically access the asyncio REPL](https://discuss.python.org/t/add-asyncio-console-module-to-progamatically-access-the-asyncio-repl/79919)

<div class="topic-metadata">

**Author:** [@provinzkraut](https://discuss.python.org/u/provinzkraut)\
**Replies:** 6\
**Last updated:** [February 10, 2025, 6:00pm UTC](https://discuss.python.org/t/add-asyncio-console-module-to-progamatically-access-the-asyncio-repl/79919 "2025-02-10T18:00:28Z")

</div>

What? Asyncio has a repl (python -m asyncio). I would like to propose to provide functionality analogous to the stdlib’s code.interact() that allows to programatically invoke this repl. The current limitations? The asyn…

---

## [Decorator to facilitate sync and async calls to one function](https://discuss.python.org/t/decorator-to-facilitate-sync-and-async-calls-to-one-function/78986)

<div class="topic-metadata">

**Author:** [@silmaril](https://discuss.python.org/u/silmaril)\
**Replies:** 6\
**Last updated:** [February 5, 2025, 6:21am UTC](https://discuss.python.org/t/decorator-to-facilitate-sync-and-async-calls-to-one-function/78986 "2025-02-05T06:21:47Z")

</div>

When writing function libraries for my colleagues, I often need to provide both async and sync methods for different use cases. I usually implement the functionality in an async method myfunction\_async() and add a sync …

---

## [High-performance Asyncio networking: sockets vs streams vs protocols](https://discuss.python.org/t/high-performance-asyncio-networking-sockets-vs-streams-vs-protocols/73420)

<div class="topic-metadata">

**Author:** [@NoahStapp](https://discuss.python.org/u/NoahStapp)\
**Replies:** 10\
**Last updated:** [December 23, 2024, 3:32pm UTC](https://discuss.python.org/t/high-performance-asyncio-networking-sockets-vs-streams-vs-protocols/73420 "2024-12-23T15:32:15Z")

</div>

I’ve working on writing high-performance asyncio network code and after having tried all three of the available APIs, I’m wondering if I’m writing my code incorrectly. The official docs suggest that working with socket …

---

## [Add asyncio monitoring hooks](https://discuss.python.org/t/add-asyncio-monitoring-hooks/26426)

<div class="topic-metadata">

**Author:** [@brettlangdon](https://discuss.python.org/u/brettlangdon)\
**Replies:** 27\
**Last updated:** [December 13, 2024, 2:31pm UTC](https://discuss.python.org/t/add-asyncio-monitoring-hooks/26426 "2024-12-13T14:31:46Z")

</div>

Similar previous discussion As an APM vendor (Datadog), I’d love to be able to provide deeper insights/metrics about the asyncio event loop for our customers. Some of the metrics I have been thinking about so far are: …

---

## [Concurrent asynchronous iteration](https://discuss.python.org/t/concurrent-asynchronous-iteration/70307)

<div class="topic-metadata">

**Author:** [@rusty-snake](https://discuss.python.org/u/rusty-snake)\
**Replies:** 3\
**Last updated:** [November 21, 2024, 3:17am UTC](https://discuss.python.org/t/concurrent-asynchronous-iteration/70307 "2024-11-21T03:17:18Z")

</div>

I want to iterate over an async iterable such that execution of the producer overlaps with execution of the consumer instead of them just merely alternating. Here is how I do it: from asyncio import CancelledError, Task…

---

## [Calling coroutines from sync code](https://discuss.python.org/t/calling-coroutines-from-sync-code/23027)

<div class="topic-metadata">

**Author:** [@srittau](https://discuss.python.org/u/srittau)\
**Replies:** 9\
**Last updated:** [October 7, 2024, 5:50pm UTC](https://discuss.python.org/t/calling-coroutines-from-sync-code/23027 "2024-10-07T17:50:06Z")

</div>

Suppose I want to call async code from a regular function and wait for its return. This function could be part of a library or could be far down a stack that is being iteratively converted to asyncio, so the fact that it…

---

## [Types for asynchronous generators too general](https://discuss.python.org/t/types-for-asynchronous-generators-too-general/64515)

<div class="topic-metadata">

**Author:** [@hurryabit](https://discuss.python.org/u/hurryabit)\
**Replies:** 2\
**Last updated:** [September 23, 2024, 10:05am UTC](https://discuss.python.org/t/types-for-asynchronous-generators-too-general/64515 "2024-09-23T10:05:15Z")

</div>

Although the following program successfully runs (and prints 42), neither pyright nor mypy accept it: import asyncio from collections.abc import AsyncGenerator async def gen() -\> AsyncGenerator\[int, None\]: yield 42…

---

## [Asyncio: when use \`call\_soon\`?](https://discuss.python.org/t/asyncio-when-use-call-soon/64525)

<div class="topic-metadata">

**Author:** [@guube](https://discuss.python.org/u/guube)\
**Replies:** 0\
**Last updated:** [September 20, 2024, 2:03pm UTC](https://discuss.python.org/t/asyncio-when-use-call-soon/64525 "2024-09-20T14:03:42Z")

</div>

Hi community! In asyncio internals or the internals of other modules that implement features on top of it, there is a lot of loop.call\_soon. Does anyone know when call\_soon should be used for callbacks, and when callbac…

---

## [Mixing async with operators for collection ABCs](https://discuss.python.org/t/mixing-async-with-operators-for-collection-abcs/64088)

<div class="topic-metadata">

**Author:** [@jace](https://discuss.python.org/u/jace)\
**Replies:** 3\
**Last updated:** [September 17, 2024, 7:20am UTC](https://discuss.python.org/t/mixing-async-with-operators-for-collection-abcs/64088 "2024-09-17T07:20:26Z")

</div>

Hello! I’m adding async support to code that makes liberal use of collection ABCs for IO-bound operations (eg: 'key' in cache). There doesn’t seem to be a good way to mix operators with async. await 'key' in cache won’t …

---

## [Add 2-state (boolean) asyncio synchronization primitive](https://discuss.python.org/t/add-2-state-boolean-asyncio-synchronization-primitive/61762)

<div class="topic-metadata">

**Author:** [@makukha](https://discuss.python.org/u/makukha)\
**Replies:** 8\
**Last updated:** [August 24, 2024, 11:14am UTC](https://discuss.python.org/t/add-2-state-boolean-asyncio-synchronization-primitive/61762 "2024-08-24T11:14:28Z")

</div>

UPD: A more general multi-valued State asyncio primitive with State(bool, False) as a special case: class State\[T\]: def \_\_init\_\_( self, values: Sequence\[T\] | type\[Enum\] | type\[bool\], default: T, …

---

## [Debugging \`asyncio\` execution time warnings when waiting for task wakeups](https://discuss.python.org/t/debugging-asyncio-execution-time-warnings-when-waiting-for-task-wakeups/59083)

<div class="topic-metadata">

**Author:** [@bmitc](https://discuss.python.org/u/bmitc)\
**Replies:** 0\
**Last updated:** [July 24, 2024, 9:26pm UTC](https://discuss.python.org/t/debugging-asyncio-execution-time-warnings-when-waiting-for-task-wakeups/59083 "2024-07-24T21:26:38Z")

</div>

Some prior discussions: Is asyncio.to\_thread always threadsafe? - Async-SIG - Discussions on Python.org Request for review of PySide6 (Qt for Python) and asyncio task prototype - Async-SIG - Discussions on Python.org T…

[Next page](https://discuss.python.org/tag/asyncio/43.md?match_all_tags=true&page=1&tags%5B%5D=asyncio)
