Commit Graph

147 Commits

Author SHA1 Message Date
Andrew Svetlov 4119d2d7c9
bpo-47062: Implement asyncio.Runner context manager (GH-31799)
Co-authored-by: Zachary Ware <zach@python.org>
2022-03-24 21:51:16 +02:00
Andrew Svetlov 0360e9f346
bpo-46829: Deprecate passing a message into Future.cancel() and Task.cancel() (GH-31840)
After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
2022-03-23 08:43:05 -07:00
Andrew Svetlov 903f0a02c1
bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-03-17 22:51:40 +02:00
Andrew Svetlov 9523c0d84f
bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API (GH-31837) 2022-03-14 13:54:13 +02:00
Andrew Svetlov 4140bcb1cd
bpo-45390: Propagate CancelledError's message from cancelled task to its awaiter (GH-31383)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-21 22:59:04 +02:00
Serhiy Storchaka 2923d87ca2
bpo-46777: Fix incorrect use of directives in asyncio documentation (GH-31388) 2022-02-18 10:58:48 +02:00
Kumar Aditya da4b214304
bpo-42413: Replace `concurrent.futures.TimeoutError` and `asyncio.TimeoutError` with builtin `TimeoutError` (GH-30197)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2021-12-19 13:22:40 +02:00
Taras Sereda 8518ee348c
removal of duplicated text paragraph (#29666) 2021-12-07 01:12:29 +02:00
Joannah Nanjekye c750adbe69
Save a reference for ensure_future and create_task (GH-29163)
Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
2021-11-15 14:30:28 -08:00
Sondre Lillebø Gundersen e25e43e355
correct spelling (GH-27076) 2021-07-19 17:46:42 -03:00
Julien Palard 15f0fc571c
Doc: Fix wrong exception used in example. (GH-26572) 2021-07-08 09:31:28 +02:00
Illia Volochii a1092f6249
bpo-43216: Remove @asyncio.coroutine (GH-26369)
Remove the @asyncio.coroutine decorator
enabling legacy generator-based coroutines to be compatible with async/await
code; remove asyncio.coroutines.CoroWrapper used for wrapping
legacy coroutine objects in the debug mode.

The decorator has been deprecated
since Python 3.8 and the removal was initially scheduled for Python 3.10.
2021-07-01 15:13:59 +02:00
Ken Jin d8fd8c8568
bpo-42392: [docs] Add deprecated-removed loop labels for asyncio (GH-26357)
* Add deprecated-removed loop labels for all reelvant functions/classes in asyncio
2021-05-26 14:59:34 -07:00
josephernest 56b8ea65d2
Updated code example for asyncio.gather (GH-20604)
The previous example did not fully showcase the interest of using gather.

Here the example showcases "the result is an aggregate list of returned values".
2021-05-13 23:06:26 -07:00
Serhiy Storchaka 172c0f2752
bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)
asyncio.get_event_loop() emits now a deprecation warning when it creates a new event loop.
In future releases it will became an alias of asyncio.get_running_loop().
2021-04-25 13:40:44 +03:00
Simon Willison 5c30145afb
bpo-42783: Documentation for asyncio.sleep(0) (#24002)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-01-07 12:03:18 +10:00
Andre Delfino dcc997cd28
[doc] Fix erroneous backslashes in signatures and names (GH-23658)
The issue being resolved is shown in the 3.10 docs (if you select docs for older versions you won't see a visual glitch).

The newer sphinx version that produces the 3.10 docs doesn't treat the backslash to escape things in some situations it previously did.
2020-12-16 17:37:28 -08:00
Yurii Karabas 86150d39c8
bpo-42392: Remove deprecated loop parameter from docs (GH-23552) 2020-11-29 14:50:57 +02:00
Jesús Cea 989af25616
Typo (#23482) 2020-11-24 00:56:30 +01:00
Jakub Stasiak 3d86d090dc
bpo-42230: Improve asyncio documentation regarding accepting sets vs 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] 620989bac5/stdlib/3/asyncio/tasks.pyi (L161)
[3] 620989bac5/stdlib/3/asyncio/tasks.pyi (L40)
2020-11-02 12:56:35 +02:00
Vinay Sharma d42528a3a2
bpo-37703: improve asyncio.gather documentation regarding cancellation (GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()

Automerge-Triggered-By: @asvetlov
2020-07-20 01:42:57 -07:00
Rémi Lapeyre 004e64e805
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874) 2020-07-01 20:41:21 -07:00
Kyle Stanley 2b201369b4
Fix asyncio.to_thread() documented return type (GH-20547)
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.
2020-05-31 00:07:04 -07:00
Bar Harel 13206b52d1
bpo-40405: Fix asyncio.as_completed docs (GH-19753)
* Fix as_completed docs to correctly state the function return value.
* Also, improves the general wording of the as_completed documentation.

Co-Authored-By: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
Co-Authored-By: Yury Selivanov <yury@edgedb.com>
2020-05-23 19:14:31 -04:00
Kyle Stanley 0f56263e62
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
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/20143#discussion_r427808225) in GH-20143 for context.

Automerge-Triggered-By: @aeros
2020-05-20 22:20:43 -07:00
Kyle Stanley cc2bbc2227
bpo-32309: Implement asyncio.to_thread() (GH-20143)
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/18410#issuecomment-628930973) in GH-18410 for context.

Automerge-Triggered-By: @aeros
2020-05-18 20:03:28 -07:00
Chris Jerdonek 1ce5841eca
bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979) 2020-05-15 16:55:50 -07:00
romasku 382a5635bd
bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() (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>
2020-05-15 13:12:05 -07:00
jack1142 de92769d47
bpo-34790: add version of removal of explicit passing of coros to `asyncio.wait`'s documentation (#20008) 2020-05-13 11:55:12 -07:00
Joel Rosdahl 9d74658f0a
bpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900)
A similar formulation was added in bpo-21596
(db74d982d4) but was lost in bpo-33649
(3faaa8857a).
2020-05-04 14:56:00 -07:00
Kyle Stanley f900064ac4 docs: Add asyncio source code links (GH-16640) 2019-10-10 19:18:46 -04:00
Kyle Stanley e407013089 Fix and improve `asyncio.run()` docs (GH-16403) 2019-09-30 17:12:21 -07:00
Emmanuel Arias 17deb16883 bpo-38260: Add Docs on asyncio.run (GH-16337)
Add docs about return and raise exception on asyncio.run





https://bugs.python.org/issue38260



Automerge-Triggered-By: @asvetlov
2019-09-25 01:53:49 -07:00
Kyle Stanley 77af2290e5 Doc: Remove provisional note for asyncio.run() (GH-16310)
Based on a comment from @asvetlov https://github.com/python/cpython/pull/15735#discussion_r323619076, this removes the provisional note for ``asyncio.run()`` in the documentation.

Automerge-Triggered-By: @1st1
2019-09-20 16:46:21 -07:00
Kyle Stanley 9fdc64cf12 bpo-34037: Fix test_asyncio failure and add loop.shutdown_default_executor() (GH-15735) 2019-09-19 15:47:22 +03:00
Andrew Svetlov a488879cba
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033) 2019-09-12 15:40:40 +03:00
Alex Grönholm 98ef92002e bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
https://bugs.python.org/issue36999
2019-05-30 08:30:09 -07:00
Matthias Bussonnier d0ebf13e50 bpo-36932: use proper deprecation-removed directive (GH-13349)
.. And update some deprecation warnings with version numbers.




https://bugs.python.org/issue36932
2019-05-20 23:20:10 -07:00
Boštjan Mejak 1d5bdef550 Orthographical fix (GH-13418)
Add a missing comma.
2019-05-19 02:01:36 -07:00
Andrew Svetlov 68b34a7204 bpo-36921: Deprecate @coroutine for sake of async def (GH-13346)
The second attempt. Now deprecate `@coroutine` only, keep `yield from fut` as is.


https://bugs.python.org/issue36921
2019-05-16 07:52:10 -07:00
Vaibhav Gupta 3a81076bbf bpo-35579: Fix typo in in asyncio-task documentation (GH-11321)
https://bugs.python.org/issue35579


https://bugs.python.org/issue35579
2018-12-26 06:47:16 -08:00
Mariatta 9f43fbbd9d Use f-strings in asyncio-task code examples (GH-10035)
Replace str.format with f-strings in the code examples of asyncio-task documentation.
2018-10-25 00:37:12 +02:00
Hrvoje Nikšić cd602b8af2 bpo-34476: Document that asyncio.sleep() always suspends. (#9643) 2018-10-01 13:09:38 +03:00
Yury Selivanov 59ee5b1293
bpo-34802: Fix asyncio.iscoroutine() docs (GH-9611) 2018-09-27 15:48:30 -04:00
Yury Selivanov fad6af2744
asyncio/docs: Replace Python 4.0 -> 3.10 (GH-9579) 2018-09-25 17:44:52 -04:00
Yury Selivanov 996859a90d
bpo-34790: [docs] Passing coroutines to asyncio.wait() can be confusing. (GH-9543) 2018-09-25 14:51:21 -04:00
Yury Selivanov db1a80e97a
bpo-33649: Fix gather() docs; fix title; few other nits. (GH-9475) 2018-09-21 16:23:15 -04:00
Yury Selivanov e247b46cba
bpo-33649: More improvements (GH-9439) 2018-09-20 12:43:59 -04:00
Yury Selivanov 471503954a
bpo-33649: Add a high-level section about Futures; few quick fixes (GH-9403)
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2018-09-18 17:55:44 -04:00
Yury Selivanov b042cf10c6
bpo-33649: Fix markup; add another note that asyncio.run is 3.7+ (GH-9389) 2018-09-18 02:47:54 -04:00