summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* Fix missing `f` prefix on f-strings (GH-91910)Miss Islington (bot)2022-04-271-1/+1
| | | | | (cherry picked from commit f882d33778ee2625ab32d90e28edb6878fb8af93) Co-authored-by: Alexander Shadchin <alexandr.shadchin@gmail.com>
* bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)Miss Islington (bot)2022-03-281-1/+2
| | | | | | Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> (cherry picked from commit 5c30388f3c586ba2f33e349e22e5949cb92de621) Co-authored-by: Vincent Bernat <vincent@bernat.ch>
* [3.9] bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910) (GH-32049)Andrew Svetlov2022-03-221-6/+9
| | | | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>. (cherry picked from commit 32e77154ddfc514a3144d5912bffdd957246fd6c) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)Miss Islington (bot)2022-03-151-1/+1
| | | | | (cherry picked from commit 70155412f1543f100d4aa309b8691cbcabd3e0e1) Co-authored-by: Maximilian Hils <git@maximilianhils.com>
* bpo-46955: Expose asyncio.base_events.Server as asyncio.Server (GH-31760)Miss Islington (bot)2022-03-081-1/+1
| | | | | | | | | This change aligns the documentation at https://docs.python.org/3/library/asyncio-eventloop.htmlGH-asyncio.Server with the actual implementation Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> (cherry picked from commit da80d6b2f3beff519cb1457d5e055168c89f7224) Co-authored-by: Stefan Zabka <zabkaste@informatik.hu-berlin.de>
* Inherit asyncio proactor datagram transport from asyncio.DatagramTransport ↵Miss Islington (bot)2022-02-231-1/+2
| | | | | | | (GH-31512) (cherry picked from commit cff4d5c5d29528299ec1ac5b3b3a6f7735577c01) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)Miss Islington (bot)2022-02-221-1/+3
| | | | | | | | Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> (cherry picked from commit 8fb94893e4a870ed3533e80c4bc2f1ebf1cfa9e7) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* [3.9] Raise TypeError if SSLSocket is passed to asyncio transport-based ↵Andrew Svetlov2022-02-202-10/+20
| | | | | | | methods (GH-31442) (GH-31444) (cherry picked from commit 1f9d4c93af380d00bf2e24bc5f5ce662d41504aa) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.9] bpo-46672: fix `NameError` in `asyncio.gather` if type check fails ↵Andrew Svetlov2022-02-201-1/+2
| | | | | (GH-31187) (GH-31441) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (31327)Miss Islington (bot)2022-02-151-4/+0
| | | | | | The docstring for `BufferedProtocol` states that the class is still an "experimental API", but it has been considered stable since 3.8. (cherry picked from commit 1d81fdc4c004511c25f74db0e04ddbbb8a04ce6d) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol ↵Miss Islington (bot)2022-02-012-0/+12
| | | | | | | | transports (GH-30958) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 64568acbd88a88d54ac9b8215447f88280448dd5) Co-authored-by: Emiya <importz750@gmail.com>
* [3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) ↵Kumar Aditya2022-01-223-6/+6
| | | | | (GH-30785) Automerge-Triggered-By: GH:asvetlov
* bpo-46278: fix typo introduced in GH-30427 (GH-30430)Miss Islington (bot)2022-01-061-2/+2
| | | | | | Automerge-Triggered-By: GH:asvetlov (cherry picked from commit b50e5e916a05df65ab6a255af7624b751e0fe9d1) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* Reflect 'context' arg in 'AbstractEventLoop.call_*()' methods (GH-30427) ↵Miss Islington (bot)2022-01-061-4/+4
| | | | | | | | | (#30429) (cherry picked from commit 3e43fac2503afe219336742b150b3ef6e470686f) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-46239: improve error message when importing `asyncio.windows_events` ↵Miss Islington (bot)2022-01-041-0/+5
| | | | | | | (GH-30353) (cherry picked from commit 5a2a65096c3ec2d37f33615f2a420d2ffcabecf2) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.9] bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) ↵Miss Islington (bot)2021-12-261-2/+2
| | | | | | | | (GH-30265) (cherry picked from commit a23ab7b6d8b3ae3a47747c0c4bceb2370cc48dcc) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-37658: Actually return result in race condition (GH-29202) (GH-29832)Miss Islington (bot)2021-11-301-6/+2
| | | | | | | (cherry picked from commit 934a82623793e9d52b85f74d5395d65927a52205) Co-authored-by: Sam Bull <aa6bs0@sambull.org> Co-authored-by: Sam Bull <aa6bs0@sambull.org>
* Cleanup a couple of comments left on PR 28775 post-merge. (GH-29079)Miss Islington (bot)2021-10-201-1/+1
| | | | | (cherry picked from commit 1dfac27dffbe771f9d88bd1726f7362ce0341437) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.9] Fix typos in the Lib directory (GH-28775) (GH-28803)Christian Clauss2021-10-072-3/+3
| | | | | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit 745c9d9dfc1ad6fdfdf1d07420c6273ff67fa5be) Automerge-Triggered-By: GH:JulienPalard
* [3.9] bpo-45097: Remove incorrect deprecation warnings in asyncio. (GH-28153)Serhiy Storchaka2021-09-045-12/+17
| | | | | | Deprecation warnings about the loop argument were incorrectly emitted in cases when the loop argument was used inside the asyncio library, not from user code.
* [3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep() (GH-27569)Sam Bull2021-08-181-8/+10
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* Trivial typo in docstring (#27505)Miss Islington (bot)2021-07-311-1/+1
| | | | | | | (cherry picked from commit 4b4227b907a262446b9d276c274feda2590a4e6e) Co-authored-by: Jesús Cea <jcea@jcea.es> Co-authored-by: Jesús Cea <jcea@jcea.es>
* bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) (#23840)Miss Islington (bot)2020-12-181-1/+4
| | | | | | | (cherry picked from commit 17ef4319a34f5a2f95e7823dfb5f5b8cff11882d) Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com> Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
* bpo-38323: Add guard clauses in MultiLoopChildWatcher. (GH-22756)Miss Islington (bot)2020-12-161-14/+18
| | | | | | This is a trivial refactor in preparation for a fix for bpo-38323. (cherry picked from commit 66d3b589c44fcbcf9afe1e442d9beac3bd8bcd34) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* bpo-34215: Clarify IncompleteReadError message when "expected" is None ↵Miss Islington (bot)2020-11-281-1/+2
| | | | | | | | | | (GH-21925) (GH-23539) Co-Authored-By: Tyler Bell <mrbell321@gmail.com> (cherry picked from commit 8085f742f4adfbc85f13fc734dfab036aa23acfb) Co-authored-by: Zackery Spytz <zspytz@gmail.com> Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-42140: Improve asyncio.wait function (GH-22938)Miss Islington (bot)2020-11-101-2/+4
| | | | | | | | | | | | | 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>
* bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() ↵Miss Islington (bot)2020-11-101-3/+22
| | | | | | | | | | | (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>
* bpo-42230: Improve asyncio documentation regarding accepting sets vs ↵Miss Skeleton (bot)2020-11-021-2/+2
| | | | | | | | | | | | | | | | | 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>
* bpo-39651: Fix asyncio proactor _write_to_self() (GH-22197)Miss Islington (bot)2020-09-122-9/+20
| | | | | | | | 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 (GH-22069) (#22071)Miss Islington (bot)2020-09-031-2/+3
| | | | | | | | | | | | | | | | * 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>
* bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22034)Miss Islington (bot)2020-09-032-2/+14
| | | | | | | | | | | 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>
* bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) ↵Miss Islington (bot)2020-08-261-3/+6
| | | | | | | | | | | (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>
* bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 ↵Miss Islington (bot)2020-08-261-2/+7
| | | | | | | | | | | (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>
* bpo-41572: Fix grammar in BaseTransport.close docstring (GH-21914) (#21929)Miss Islington (bot)2020-08-211-2/+2
| | | | | | | | | | 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>
* bpo-40782: Change asyncio.AbstractEventLoop.run_in_executor to be a method ↵Miss Islington (bot)2020-08-171-1/+1
| | | | | | | | | 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>
* bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)Miss Islington (bot)2020-08-041-1/+1
| | | | | | | | 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>
* bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() ↵Miss Islington (bot)2020-07-231-7/+6
| | | | | | | (GH-21595) (cherry picked from commit 0dd98c2d00a75efbec19c2ed942923981bc06683) Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
* bpo-37703: improve asyncio.gather documentation regarding cancellation ↵Miss Islington (bot)2020-07-201-0/+7
| | | | | | | | | | (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>
* bpo-40967: Remove deprecated asyncio.Task.current_task() and ↵Miss Islington (bot)2020-07-021-28/+0
| | | | | | | asyncio.Task.all_tasks() (GH-20874) (cherry picked from commit 004e64e8059fe68a72890314673282f2e60d5ce1) Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
* Fix asyncio.to_thread() documented return type (GH-20547)Miss Islington (bot)2020-05-311-1/+1
| | | | | | | | 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>
* bpo-30064: Fix asyncio loop.sock_* race condition issue (GH-20369)Miss Islington (bot)2020-05-271-16/+25
| | | | | (cherry picked from commit 210a137396979d747c2602eeef46c34fc4955448) Co-authored-by: Fantix King <fantix.king@gmail.com>
* bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)Miss Islington (bot)2020-05-211-2/+6
| | | | | | | | 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>
* s/wakup/wakeup (GH-20250)Miss Islington (bot)2020-05-201-1/+1
| | | | | | | | (as title) Automerge-Triggered-By: @Mariatta (cherry picked from commit f2947e354c95d246b1836ac78d4c820c420e259b) Co-authored-by: Kunal Bhalla <bhalla.kunal@gmail.com>
* bpo-32309: Implement asyncio.to_thread() (GH-20143)Miss Islington (bot)2020-05-192-0/+23
| | | | | | | | 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>
* bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)Chris Jerdonek2020-05-182-19/+33
| | | | | 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."
* bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979)Chris Jerdonek2020-05-153-19/+36
|
* bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() ↵romasku2020-05-151-1/+9
| | | | | | | | | | | | | | | (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>
* bpo-40443: Remove unused imports in the stdlib (GH-19803)Victor Stinner2020-04-302-2/+0
|
* Fix typo from Lib/asyncio/events.py (GH-19410)Galden2020-04-141-1/+1
|
* bpo-39764: Make Task.get_stack accept ag_frame (#18669)Lidi Zheng2020-03-021-3/+10
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>