summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. ↵Yury Selivanov2017-06-111-0/+1
| | | | (#2109)
* bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)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 (cherry picked from commit 991adca012f5e106c2d4040ce619c696ba6f9c46)
* bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future ↵Mariatta2017-04-221-1/+2
| | | | | (GH-1170) (#1247) (cherry picked from commit ae5b3260dd459845aad8a30491b76d471577785d)
* 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
|
* asyncio: Make Tasks check if Futures are attached to the same event loopYury Selivanov2015-12-111-1/+7
| | | | See https://github.com/python/asyncio/pull/303 for details
* asyncio: Drop "value" parameter from Task._step method.Yury Selivanov2015-11-201-10/+12
|
* asyncio: Cleanup Future APIYury Selivanov2015-11-171-1/+2
| | | | See https://github.com/python/asyncio/pull/292 for details.
* asyncio: Sync with githubYury Selivanov2015-11-171-3/+0
|
* asyncio: Optimize Task._wakeupYury Selivanov2015-11-161-2/+11
| | | | See https://github.com/python/asyncio/pull/289 for details.
* asyncio: Optimize asyncio.sleep(0)Yury Selivanov2015-11-051-0/+4
|
* Docs and one small improvement for issue #25304, by Vincent Michel.Guido van Rossum2015-10-051-1/+6
|
* Issue #25304: Add asyncio.run_coroutine_threadsafe(). By Vincent Michel.Guido van Rossum2015-10-031-1/+17
|
* asyncio: ensure_future() now understands awaitablesYury Selivanov2015-10-021-2/+14
|
* Issue #24867: Fix Task.get_stack() for 'async def' coroutinesYury Selivanov2015-08-141-1/+5
|
* Revert da29a94367b2Yury Selivanov2015-08-021-2/+3
|
* asyncio: Fix code styleYury Selivanov2015-08-021-3/+2
|
* asyncio: sync with githubVictor Stinner2015-07-251-2/+0
| | | | | | | | | * Fix ResourceWarning warnings in test_streams * Return True from StreamReader.eof_received() to fix http://bugs.python.org/issue24539 (but still needs a unittest). Add StreamReader.__repr__() for easy debugging. * remove unused imports * Issue #234: Drop JoinableQueue on Python 3.5+
* asyncio: Add asyncio.compat moduleVictor Stinner2015-07-251-3/+2
| | | | | Move compatibility helpers for the different Python versions to a new asyncio.compat module.
* asyncio: Drop some useless code from tasks.py.Yury Selivanov2015-05-281-7/+2
| | | | See also issue 24017.
* asyncio: Support PEP 492. Issue #24017.Yury Selivanov2015-05-121-2/+6
|
* asyncio: async() function is deprecated in favour of ensure_future().Yury Selivanov2015-05-111-6/+21
|
* asyncio: sync with TulipVictor Stinner2015-01-291-1/+1
| | | | | | | | | * Cleanup gather(): use cancelled() method instead of using private Future attribute * Fix _UnixReadPipeTransport and _UnixWritePipeTransport. Only start reading when connection_made() has been called. * Issue #23333: Fix BaseSelectorEventLoop._accept_connection(). Close the transport on error. In debug mode, log errors using call_exception_handler()
* Closes #23219: cancelling asyncio.wait_for() now cancels the taskVictor Stinner2015-01-151-4/+8
|
* asyncio: sync with TulipVictor Stinner2015-01-091-4/+7
| | | | | | | | * Document why set_result() calls are safe * Cleanup gather(). Use public methods instead of hacks to consume the exception of a future. * sock_connect(): pass directly the fd to _sock_connect_done instead of the socket.
* asyncio: Truncate to 80 columnsVictor Stinner2015-01-081-1/+1
|
* asyncio: Initialize more Future and Task attributes in the class definition toVictor Stinner2014-12-041-3/+4
| | | | avoid attribute errors in destructors.
* Closes #22475: asyncio doc, fix Task.get_stack() docVictor Stinner2014-12-021-1/+1
|
* Apply asyncio Task English fixes to docstrings as well.R David Murray2014-09-241-9/+10
| | | | Also fixed the phrasing in a comment.
* asyncio, Tulip issue 201: Fix a race condition in wait_for()Victor Stinner2014-08-281-6/+9
| | | | | | Don't raise a TimeoutError if we reached the timeout and the future completed in the same iteration of the event loop. A side effect of the bug is that Queue.get() looses items.
* asyncio: sync with TulipVictor Stinner2014-07-291-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | * _WaitHandleFuture.cancel() now notify IocpProactor through the overlapped object that the wait was cancelled. * Optimize IocpProactor.wait_for_handle() gets the result if the wait is signaled immediatly. * Enhance representation of Future and Future subclasses - Add "created at filename:lineno" in the representation - Add Future._repr_info() method which can be more easily overriden than Future.__repr__(). It should now be more easy to enhance Future representation without having to modify each subclass. For example, _OverlappedFuture and _WaitHandleFuture get the new "created at" information. - Use reprlib to format Future result, and function arguments when formatting a callback, to limit the length of the representation. * Fix repr(_WaitHandleFuture) * _WaitHandleFuture and _OverlappedFuture: hide frames of internal calls in the source traceback. * Cleanup ProactorIocp._poll(): set the timeout to 0 after the first call to GetQueuedCompletionStatus() * test_locks: close the temporary event loop and check the condition lock * Remove workaround in test_futures, no more needed
* Issue #21163: Fix "destroy pending task" warning in test_wait_errors()Victor Stinner2014-07-161-2/+2
|
* Issue #21163, asyncio: Ignore "destroy pending task" warnings for private tasksVictor Stinner2014-07-161-11/+23
| | | | in gather().
* asyncio: sync with TulipVictor Stinner2014-07-111-1/+0
| | | | | | | | | | * Tulip issue #182: Improve logs of BaseEventLoop._run_once() - Don't log non-blocking poll - Only log polling with a timeout if it gets events or if it timed out after more than 1 second. * Fix some pyflakes warnings: remove unused imports
* asyncio: sync with TulipVictor Stinner2014-07-101-1/+0
| | | | | | | - CoroWrapper.__del__() now reuses repr(CoroWrapper) to log the "... was never yielded from" warning - Improve CoroWrapper: copy also the qualified name on Python 3.4, not only on Python 3.5+
* asyncio: sync with TulipVictor Stinner2014-07-101-1/+6
| | | | | | | - repr(Task) and repr(CoroWrapper) now also includes where these objects were created. If the coroutine is not a generator (don't use "yield from"), use the location of the function, not the location of the coro() wrapper. - Fix create_task(): truncate the traceback to hide the call to create_task().
* asyncio: sync with TulipVictor Stinner2014-07-081-1/+3
| | | | | | | | | | | - Tulip issue 185: Add a create_task() method to event loops. The create_task() method can be overriden in custom event loop to implement their own task class. For example, greenio and Pulsar projects use their own task class. The create_task() method is now preferred over creating directly task using the Task class. - tests: fix a warning - fix typo in the name of a test function - Update AbstractEventLoop: add new event loop methods; update also the unit test
* Closes #21886, #21447: Fix a race condition in asyncio when setting the resultVictor Stinner2014-07-051-1/+2
| | | | | of a Future with call_soon(). Add an helper, a private method, to set the result only if the future was not cancelled.