| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
GH- Improve asyncio.wait function
The original code creates the futures set two times.
We can create this set before, avoiding the second creation.
This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty.
Automerge-Triggered-By: GH:1st1
(cherry picked from commit 7e5ef0a5713f968f6e942566c78bf57ffbef01de)
Co-authored-by: Diogo Dutra <diogodutradamata@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-23020)
The overflow occurs under some circumstances when a task or future
recursively returns itself.
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 42d873c63aa9d160c132be4a34599531574db12c)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
iterables (GH-23073)
People call wait() and as_completed() with various non-set iterables,
a list should be the most common but there are others as well[1].
Considering typeshed also documents wait()[2] and as_completed()[3]
as accepting arbitrary iterables I think it's a good idea to document
the status quo better.
[1] https://github.com/aio-libs/aiokafka/pull/672
[2] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L161
[3] https://github.com/python/typeshed/blob/620989bac572f30349b95590ebe81a73ce0fe862/stdlib/3/asyncio/tasks.pyiGH-L40
(cherry picked from commit 3d86d090dcbbdfdd3e5a5951cab30612d6131222)
Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
|
|
|
|
|
|
|
|
| |
Fix a race condition in the call_soon_threadsafe() method of
asyncio.ProactorEventLoop: do nothing if the self-pipe socket has
been closed.
(cherry picked from commit 1b0f0e3d7d03155da1cf9769a847874d559e57e3)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-41696: Fix handling of debug mode in asyncio.run
This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run
* 📜🤖 Added by blurb_it.
Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0770ad948cb6d9f7f6c4002efd83e27c27069808)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
(cherry picked from commit ea5a6363c3f8cc90b7c0cc573922b10f296073b6)
Co-authored-by: Ben Darnell <ben@bendarnell.com>
Co-authored-by: Ben Darnell <ben@bendarnell.com>
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-21964)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running. This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a14627256197bddcf4fcecad4c264c1e39d)
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-21895) (GH-21963)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative. This takes care of that.
Props to @aaliddell for noticing the inconsistency.
(cherry picked from commit c517fc712105c8e5930cb42baaebdbe37fc3e15f)
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
|
|
|
|
|
|
|
|
|
|
| |
Fix grammar in BaseTransport.close docstring.
https://bugs.python.org/issue41572
Signed-off-by: Cleber Rosa <crosa@redhat.com>
(cherry picked from commit 1afb42cfa82dad0ddd726f59c6c5fcb3962314db)
Co-authored-by: Cleber Rosa <cleber.gnu@gmail.com>
|
|
|
|
|
|
|
|
|
| |
not a coroutine (GH-21852)
asyncio.AbstractEventLoop.run_in_executor should be a method that returns an asyncio Future, not an async method.
This matches the concrete implementations, and the documentation better.
(cherry picked from commit 29f84294d88ec493c2de9d6e8dbc12fae3778771)
Co-authored-by: James Weaver <james.barrett@bbc.co.uk>
|
|
|
|
|
|
|
|
| |
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
(cherry picked from commit 602a971a2af3a685d625c912c400cadd452718b1)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
|
|
|
|
|
| |
(GH-21595)
(cherry picked from commit 0dd98c2d00a75efbec19c2ed942923981bc06683)
Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
|
|
|
|
|
|
|
|
|
|
| |
(GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()
Automerge-Triggered-By: @asvetlov
(cherry picked from commit d42528a3a2c7d79fd2e6c9f2a02f3ce12d44c8cc)
Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
|
|
|
|
|
|
|
| |
asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e8059fe68a72890314673282f2e60d5ce1)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
|
|
|
|
|
|
|
|
| |
When I wrote the documentation for `asyncio.to_thread()`, I mistakenly assumed that `return await loop.run_in_executor(...)` within an async def function would return a Future. In reality, it returns a coroutine.
This likely won't affect typical usage of `asyncio.to_thread()`, but it's important for the documentation to be correct here. In general, we also tend to avoid returning futures from high-level APIs in asyncio.
(cherry picked from commit 2b201369b435a4266bda5b895e3b615dbe28ea6e)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit 210a137396979d747c2602eeef46c34fc4955448)
Co-authored-by: Fantix King <fantix.king@gmail.com>
|
|
|
|
|
|
|
|
| |
Allows contextvars from the main thread to be accessed in the separate thread used in `asyncio.to_thread()`. See the [discussion](https://github.com/python/cpython/pull/20143GH-discussion_r427808225) in GH-20143 for context.
Automerge-Triggered-By: @aeros
(cherry picked from commit 0f56263e62ba91d0baae40fb98947a3a98034a73)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
|
|
|
|
|
|
|
|
| |
(as title)
Automerge-Triggered-By: @Mariatta
(cherry picked from commit f2947e354c95d246b1836ac78d4c820c420e259b)
Co-authored-by: Kunal Bhalla <bhalla.kunal@gmail.com>
|
|
|
|
|
|
|
|
| |
Implements `asyncio.to_thread`, a coroutine for asynchronously running IO-bound functions in a separate thread without blocking the event loop. See the discussion starting from [here](https://github.com/python/cpython/pull/18410GH-issuecomment-628930973) in GH-18410 for context.
Automerge-Triggered-By: @aeros
(cherry picked from commit cc2bbc2227c3f5ed9d8f6b3bd052e6f9e68279d2)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
|
|
|
|
|
| |
When an asyncio.Task is cancelled, the exception traceback now
starts with where the task was first interrupted. Previously,
the traceback only had "depth one."
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-20054)
Currently, if asyncio.wait_for() timeout expires, it cancels
inner future and then always raises TimeoutError. In case
those future is task, it can handle cancelation mannually,
and those process can lead to some other exception. Current
implementation silently loses thoses exception.
To resolve this, wait_for will check was the cancelation
successfull or not. In case there was exception, wait_for
will reraise it.
Co-authored-by: Roman Skurikhin <roman.skurikhin@cruxlab.com>
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
|
|
|
|
| |
(GH-18458)
Just a small debugging improvement to identify the asyncio executor threads.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Motivation for this PR (comment from @vstinner in bpo issue):
```
Warning seen o AMD64 Ubuntu Shared 3.x buildbot:
https://buildbot.python.org/all/#/builders/141/builds/2593
test_devnull_output (test.test_a=syncio.test_subprocess.SubprocessThreadedWatcherTests) ...
Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2)
```
The following implementation details for the new method are TBD:
1) Public vs private
2) Inclusion in `close()`
3) Name
4) Coroutine vs subroutine method
5) *timeout* parameter
If it's a private method, 3, 4, and 5 are significantly less important.
I started with the most minimal implementation that fixes the dangling threads without modifying the regression tests, which I think is particularly important. I typically try to avoid directly modifying existing tests as much as possible unless it's necessary to do so. However, I am open to changing any part of this.
https://bugs.python.org/issue38356
|
|
|
| |
https://bugs.python.org/issue39191
|
| |
|
|
|
|
| |
(GH-16977)
|
| |
|
| |
|
|
|
|
| |
Fix asyncio when the ssl module is missing: only check for
ssl.SSLSocket instance if the ssl module is available.
|
|
|
|
|
| |
functions (GH-16457)
https://bugs.python.org/issue37404
|
| |
|
|
|
| |
https://bugs.python.org/issue38978
|
|
|
|
|
|
| |
If waitpid() is called elsewhere, waitpid() call fails with
ChildProcessError: use return code 255 in this case, and log a
warning. It ensure that the pidfd file descriptor is closed if this
error occurs.
|
|
|
| |
https://bugs.python.org/issue38951
|
|
|
|
|
|
|
| |
creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.
See for example GH-13135
|
|
|
|
|
|
|
|
|
|
| |
/cc @asvetlov @1st1
https://bugs.python.org/issue38692
Automerge-Triggered-By: @benjaminp
|
| |
|
|
|
|
|
|
|
| |
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future`
https://bugs.python.org/issue38785
|
|
|
|
| |
bpo-34679, bpo-38563: asyncio.ProactorEventLoop.close() now only calls
signal.set_wakeup_fd() in the main thread.
|
| |
|
| |
|
|
|
| |
See https://bugs.python.org/issue38242 for more details
|
|
|
|
| |
(GH-16472)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add docs about return and raise exception on asyncio.run
https://bugs.python.org/issue38260
Automerge-Triggered-By: @asvetlov
|