summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_tasks.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. ↵Zackery Spytz2018-12-171-0/+9
| | | | (GH-11175)
* bpo-34890: Make iscoroutinefunction, isgeneratorfunction and ↵Pablo Galindo2018-10-261-2/+2
| | | | | | | | | | | isasyncgenfunction work with functools.partial (GH-9903) inspect.isfunction() processes both inspect.isfunction(func) and inspect.isfunction(partial(func, arg)) correctly but some other functions in the inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction) lack this functionality. This commits adds a new check in the mentioned functions in the inspect module so they can work correctly with arbitrarily nested partial functions.
* bpo-34872: Fix self-cancellation in C implementation of asyncio.Task (GH-9679)Elvis Pranskevichus2018-10-031-0/+36
| | | | | | | | | | | | | | | | | The C implementation of asyncio.Task currently fails to perform the cancellation cleanup correctly in the following scenario. async def task1(): async def task2(): await task3 # task3 is never cancelled asyncio.current_task().cancel() await asyncio.create_task(task2()) The actuall error is a hardcoded call to `future_cancel()` instead of calling the `cancel()` method of a future-like object. Thanks to Vladimir Matveev for noticing the code discrepancy and to Yury Selivanov for coming up with a pathological scenario.
* bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)Yury Selivanov2018-10-021-98/+87
|
* bpo-34728: Remove deprecate *loop* argument in asyncio.sleep (GH-9415)João Júnior2018-09-241-0/+29
| | | | | | | | | | | | | | | | * 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
* Make regular expressions in test_tasks.py raw strings. (GH-8759)Benjamin Peterson2018-08-141-2/+2
| | | | | | | | | | | Follow up to bpo-34270. Fixes: ``` Lib/test/test_asyncio/test_tasks.py:330: DeprecationWarning: invalid escape sequence \d match1 = re.match("^<Task pending name='Task-(\d+)'", repr(t1)) Lib/test/test_asyncio/test_tasks.py:332: DeprecationWarning: invalid escape sequence \d match2 = re.match("^<Task pending name='Task-(\d+)'", repr(t2)) ```
* bpo-34270: Make it possible to name asyncio tasks (GH-8547)Alex Grönholm2018-08-081-7/+48
| | | Co-authored-by: Antti Haapala <antti.haapala@anttipatterns.com>
* bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462)Victor Stinner2018-06-061-1/+5
| | | | | | | Fix "<CoroWrapper ...> was never yielded from" warning in PyTask_PyFuture_Tests.test_error_in_call_soon() of test_asyncio.test_tasks. Close manually the coroutine on error.
* bpo-33789, test_asyncio: Hide PendingDeprecationWarning (GH-7461)Victor Stinner2018-06-061-1/+2
| | | Hide PendingDeprecationWarning in test__register_task_3().
* bpo-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-0/+4
| | | | tests (GH-7328)
* bpo-32684: Fix nits in tests (GH-7225)Yury Selivanov2018-05-291-3/+3
|
* bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216)Elvis Pranskevichus2018-05-291-0/+56
| | | | | | | | | | | | | | | | | | | | | | | 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/+28
| | | | (GH-7209)
* bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)Yury Selivanov2018-05-281-2/+27
|
* bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)Oren Milman2018-02-131-0/+14
|
* bpo-32327: Revert loop.run_in_executor behaviour: return a Future. (#5392)Yury Selivanov2018-01-281-3/+2
| | | | I've run some tests on 3.7 asyncio and it appears that too many things assume that run_in_executor returns a Future.
* bpo-32636: Fix two bugs in test_asyncio (#5302)Victor Stinner2018-01-241-1/+1
|
* bpo-32636: Fix @asyncio.coroutine debug mode bug exposed by gh-5250 (#5291)Nathaniel J. Smith2018-01-241-0/+17
|
* bpo-32643: Drop support for a few private Task and Future APIs. (#5293)Yury Selivanov2018-01-241-25/+3
| | | | | | | | Specifically, it's not possible to subclass Task/Future classes and override the following methods: * Future._schedule_callbacks * Task._step * Task._wakeup
* bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280)Nathaniel J. Smith2018-01-231-2/+8
|
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-231-10/+99
|
* bpo-31721: Allow Future._log_traceback to only be set to False (#5009)Yury Selivanov2017-12-251-0/+9
|
* bpo-32363: Disable Task.set_exception() and Task.set_result() (#4923)Yury Selivanov2017-12-251-22/+71
|
* bpo-32415: Fix "error is already set" (#4999)Yury Selivanov2017-12-231-0/+26
|
* bpo-32415: Add more tests (#4995)Yury Selivanov2017-12-231-3/+21
|
* bpo-32415: Add asyncio.Task.get_loop() and Future.get_loop() (#4992)Yury Selivanov2017-12-231-5/+8
|
* bpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915)Yury Selivanov2017-12-191-0/+43
|
* bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)Yury Selivanov2017-12-181-6/+37
|
* bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799)Andrew Svetlov2017-12-161-23/+183
|
* bpo-32311: Implement asyncio.create_task() shortcut (#4848)Andrew Svetlov2017-12-151-0/+37
| | | | | * Implement functionality * Add documentation
* bpo-32327: Convert asyncio functions documented as coroutines to coroutines. ↵Yury Selivanov2017-12-151-7/+14
| | | | (#4872)
* bpo-32101: Fix tests for PYTHONDEVMODE=1 (#4821)Victor Stinner2017-12-121-7/+5
| | | | test_asycio: remove also aio_path which was used when asyncio was developed outside the stdlib.
* bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)Yury Selivanov2017-12-111-12/+3
|
* bpo-32193: Convert asyncio to async/await usage (#4753)Andrew Svetlov2017-12-081-147/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* bpo-32047: -X dev enables asyncio debug mode (#4418)Victor Stinner2017-11-201-0/+4
| | | | The new -X dev command line option now also enables asyncio debug mode.
* bpo-31970: Reduce performance overhead of asyncio debug mode. (#4314)Antoine Pitrou2017-11-071-1/+1
| | | | * bpo-31970: Reduce performance overhead of asyncio debug mode.
* bpo-30406: Make async and await proper keywords (#1669)Jelle Zijlstra2017-10-061-6/+0
| | | Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
* bpo-31556: asyncio.wait_for can cancel futures faster with timeout <= 0 (#3703)Victor K2017-10-051-0/+70
|
* bpo-31061: fix crash in asyncio speedup module (GH-2966)Alexander Mohr2017-08-021-0/+15
|
* bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050)Yury Selivanov2017-06-111-0/+19
|
* bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)INADA Naoki2017-05-111-0/+18
| | | | | | | | | | | | 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-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406)Yury Selivanov2017-03-031-0/+17
|
* Remove unused imports.Serhiy Storchaka2016-12-161-1/+0
|
* Merge 3.6 (issue #28843)Yury Selivanov2016-12-011-0/+15
|
* Merge 3.5 (issue #28703)Yury Selivanov2016-11-151-0/+2
|\
| * Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects.Yury Selivanov2016-11-151-0/+2
| |
* | Merge 3.5 (issue #28613)Yury Selivanov2016-11-041-0/+5
|\ \ | |/
| * Issue #28613: Fix get_event_loop() to return the current loopYury Selivanov2016-11-041-0/+5
| | | | | | | | when called from coroutines or callbacks.
* | Issue #28544: Implement asyncio.Task in C.Yury Selivanov2016-10-281-134/+305
|/ | | | | | | | 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-0/+30
| | | | | | are done. Patch by Johannes Ebke.