summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-36607: Eliminate RuntimeError raised by asyncio.all_tasks() (GH-13971)Andrew Svetlov2019-06-111-6/+32
| | | | | | | If internal tasks weak set is changed by another thread during iteration. https://bugs.python.org/issue36607
* bpo-36999: Add asyncio.Task.get_coro() (GH-13680)Alex Grönholm2019-05-301-0/+3
| | | https://bugs.python.org/issue36999
* bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)Yury Selivanov2019-05-271-4/+6
| | | | | | | | | | | | | | | This will address the common mistake many asyncio users make: an "except Exception" clause breaking Tasks cancellation. In addition to this change, we stop inheriting asyncio.TimeoutError and asyncio.InvalidStateError from their concurrent.futures.* counterparts. There's no point for these exceptions to share the inheritance chain. In 3.9 we'll focus on implementing supervisors and cancel scopes, which should allow better handling of all exceptions, including SystemExit and KeyboardInterrupt
* bpo-36932: use proper deprecation-removed directive (GH-13349)Matthias Bussonnier2019-05-211-8/+8
| | | | | | | | .. And update some deprecation warnings with version numbers. https://bugs.python.org/issue36932
* bpo-36921: Deprecate @coroutine for sake of async def (GH-13346)Andrew Svetlov2019-05-161-2/+4
| | | | | | The second attempt. Now deprecate `@coroutine` only, keep `yield from fut` as is. https://bugs.python.org/issue36921
* bpo-35125: remove inner callback on outer cancellation in asyncio shield ↵Romain Picard2019-05-071-2/+8
| | | | | | | | | | | | | | (GH-10340) When the future returned by shield is cancelled, its completion callback of the inner future is not removed. This makes the callback list of inner inner future grow each time a shield is created and cancelled. This change unregisters the callback from the inner future when the outer future is cancelled. https://bugs.python.org/issue35125
* bpo-24638: Improve the error message in asyncio.ensure_future() (#12848)Zackery Spytz2019-05-031-1/+2
|
* bpo-36613: call remove_done_callback if exception (GH-12800)gescheit2019-05-031-1/+2
| | | | | | Call remove_done_callback() in finally block. https://bugs.python.org/issue36613
* asyncio: PendingDeprecationWarning -> DeprecationWarning (GH-12494)Inada Naoki2019-03-221-2/+2
| | | `Task.current_task()` and `Task.all_tasks()` will be removed in 3.9.
* bpo-34970: Protect tasks weak set manipulation in asyncio.all_tasks() (GH-9837)Andrew Svetlov2018-10-131-2/+6
| | | https://bugs.python.org/issue34970
* asyncio/docs: Replace Python 4.0 -> 3.10 (GH-9579)Yury Selivanov2018-09-251-6/+6
|
* bpo-34728: Remove deprecate *loop* argument in asyncio.sleep (GH-9415)João Júnior2018-09-241-3/+16
| | | | | | | | | | | | | | | | * Insert the warn in the asyncio.sleep when the loop argument is used * Insert the warn in the asyncio.wait and asyncio.wait_for when the loop argument is used * Better format of the code * Add news file * change calls for get_event_loop() to calls for get_running_loop() * Change message to be more clear in News * Improve the comments in test_tasks
* bpo-34622: Extract asyncio exceptions into a separate module (GH-9141)Andrew Svetlov2018-09-111-12/+13
|
* bpo-34270: Make it possible to name asyncio tasks (GH-8547)Alex Grönholm2018-08-081-3/+32
| | | Co-authored-by: Antti Haapala <antti.haapala@anttipatterns.com>
* bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216)Elvis Pranskevichus2018-05-291-2/+21
| | | | | | | | | | | | | | | | | | | | | | | Currently, asyncio.wait_for(fut), upon reaching the timeout deadline, cancels the future and returns immediately. This is problematic for when *fut* is a Task, because it will be left running for an arbitrary amount of time. This behavior is iself surprising and may lead to related bugs such as the one described in bpo-33638: condition = asyncio.Condition() async with condition: await asyncio.wait_for(condition.wait(), timeout=0.5) Currently, instead of raising a TimeoutError, the above code will fail with `RuntimeError: cannot wait on un-acquired lock`, because `__aexit__` is reached _before_ `condition.wait()` finishes its cancellation and re-acquires the condition lock. To resolve this, make `wait_for` await for the task cancellation. The tradeoff here is that the `timeout` promise may be broken if the task decides to handle its cancellation in a slow way. This represents a behavior change and should probably not be back-patched to 3.6 and earlier.
* bpo-32684: Fix gather to propagate cancel of itself with return_exceptions ↵Yury Selivanov2018-05-291-1/+13
| | | | (GH-7209)
* bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)Yury Selivanov2018-05-281-1/+11
|
* bpo-33505: Optimize asyncio.ensure_future by reordering if conditions (GH-6836)jimmylai2018-05-281-5/+5
|
* bpo-33584: Fix several minor bugs in asyncio. (GH-7003)Serhiy Storchaka2018-05-201-1/+1
| | | | | | | | | | | | Fix the following bugs in the C implementation: * get_future_loop() silenced all exceptions raised when look up the get_loop attribute, not just an AttributeError. * enter_task() silenced all exceptions raised when look up the current task, not just a KeyError. * repr() was called for a borrowed link in enter_task() and task_step_impl(). * str() was used instead of repr() in formatting one error message (in Python implementation too). * There where few reference leaks in error cases.
* bpo-32643: Drop support for a few private Task and Future APIs. (#5293)Yury Selivanov2018-01-241-14/+14
| | | | | | | | Specifically, it's not possible to subclass Task/Future classes and override the following methods: * Future._schedule_callbacks * Task._step * Task._wakeup
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-8/+16
|
* bpo-32363: Disable Task.set_exception() and Task.set_result() (#4923)Yury Selivanov2017-12-251-7/+17
|
* bpo-32415: Add asyncio.Task.get_loop() and Future.get_loop() (#4992)Yury Selivanov2017-12-231-22/+17
|
* bpo-32355: Optimize asyncio.gather() (#4913)Yury Selivanov2017-12-191-42/+61
|
* bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)Andrew Svetlov2017-12-171-1/+1
| | | | | | * Use fastpath in asyncio.sleep if delay<0 * Add NEWS entry
* bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799)Andrew Svetlov2017-12-161-14/+87
|
* bpo-32311: Implement asyncio.create_task() shortcut (#4848)Andrew Svetlov2017-12-151-4/+19
| | | | | * Implement functionality * Add documentation
* bpo-32272: Remove asyncio.async() function. (#4784)Yury Selivanov2017-12-111-21/+1
|
* bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)Yury Selivanov2017-12-101-35/+28
|
* bpo-32193: Convert asyncio to async/await usage (#4753)Andrew Svetlov2017-12-081-23/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Convert asyncio/tasks.py to async/await * Convert asyncio/queues.py to async/await * Convert asyncio/test_utils.py to async/await * Convert asyncio/base_subprocess.py to async/await * Convert asyncio/subprocess.py to async/await * Convert asyncio/streams.py to async/await * Fix comments * Convert asyncio/locks.py to async/await * Convert asyncio.sleep to async def * Add a comment * Add missing news * Convert stubs from AbstrctEventLoop to async functions * Convert subprocess_shell/subprocess_exec * Convert connect_read_pipe/connect_write_pip to async/await syntax * Convert create_datagram_endpoint * Convert create_unix_server/create_unix_connection * Get rid of old style coroutines in unix_events.py * Convert selector_events.py to async/await * Convert wait_closed and create_connection * Drop redundant line * Convert base_events.py * Code cleanup * Drop redundant comments * Fix indentation * Add explicit tests for compatibility between old and new coroutines * Convert windows event loop to use async/await * Fix double awaiting of async function * Convert asyncio/locks.py * Improve docstring * Convert tests to async/await * Convert more tests * Convert more tests * Convert more tests * Convert tests * Improve test
* asyncio: Remove asyncio/compat.py (#4606)Victor Stinner2017-11-281-2/+1
| | | | | | | | | | The asyncio/compat.py file was written to support Python < 3.5 and Python < 3.5.2. But Python 3.5 doesn't accept bugfixes anymore, only security fixes. There is no more need to backport bugfixes to Python 3.5, and so no need to have a single code base for Python 3.5, 3.6 and 3.7. Say hello (again) to "async" and "await", who became real keywords in Python 3.7 ;-)
* bpo-31556: asyncio.wait_for can cancel futures faster with timeout <= 0 (#3703)Victor K2017-10-051-0/+9
|
* bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050)Yury Selivanov2017-06-111-0/+1
|
* bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)INADA Naoki2017-05-111-1/+6
| | | | | | | | | | | | when there are no more `await` or `yield (from)` before return in coroutine, cancel was ignored. example: async def coro(): asyncio.Task.current_task().cancel() return 42 ... res = await coro() # should raise CancelledError
* bpo-29617: Remove Python 3.3 support from asyncio (GH-232)INADA Naoki2017-04-251-14/+10
|
* bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future ↵Charles Renwick2017-04-211-1/+2
| | | | (GH-1170)
* Issue #29314: Merge with 3.5Mariatta Wijaya2017-02-071-1/+2
|\
| * Issue #29314: Set the stacklevel to two in asyncio.async() Deprecation WarningMariatta Wijaya2017-02-071-1/+2
| |
* | Issue #28544: Implement asyncio.Task in C.Yury Selivanov2016-10-281-64/+16
|/ | | | | | | | This implementation provides additional 10-20% speed boost for asyncio programs. The patch also fixes _asynciomodule.c to use Arguments Clinic, and makes '_schedule_callbacks' an overridable method (as it was in 3.5).
* Issue #26923: Fix asyncio.Gather to refuse being cancelled once all children ↵Yury Selivanov2016-10-211-2/+4
| | | | | | are done. Patch by Johannes Ebke.
* Issue #27972: Prohibit Tasks to await on themselves.Yury Selivanov2016-10-091-7/+14
|
* Misc asyncio improvements from upstreamGuido van Rossum2016-09-301-0/+4
|
* Another asyncio sync.Yury Selivanov2016-09-151-1/+6
|
* Merge asyncio upstream.Guido van Rossum2016-09-091-4/+4
|
* Rename Future._blocking to _asyncio_future_blocking.Guido van Rossum2016-09-091-3/+4
| | | | | | | | | | | | This is now an official "protected" API that can be used to write classes that are duck-type-compatible with Future without subclassing it. (For that purpose I also changed isinstance(result, Future) to check for this attribute instead.) Hopefully Amber Brown can use this to make Twisted.Deferred compatible with asyncio.Future. Tests and docs are TBD.
* asyncio: Remove asyncio.timeout() context manager.Yury Selivanov2016-06-081-53/+0
| | | | | | | It will probably be added back in Python 3.6, once its compatibility issues are resolved; see [1] for more details. [1] https://mail.python.org/pipermail/async-sig/2016-June/000045.html
* Issue #27041: asyncio: Add loop.create_future methodYury Selivanov2016-05-161-5/+9
|
* asyncio: allow None as wait timeoutVictor Stinner2016-04-011-6/+8
| | | | | | Fix GH#325: Allow to pass None as a timeout value to disable timeout logic. Change written by Andrew Svetlov and merged by Guido van Rossum.
* Sync with asyncioAndrew Svetlov2016-01-111-1/+1
|
* Sync with asyncio repoAndrew Svetlov2016-01-111-0/+51
|