summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* asyncio: sync with TulipVictor Stinner2014-07-021-0/+3
| | | | | | | | | | * _UnixSubprocessTransport: fix file mode of stdin. Open stdin in write mode, not in read mode * Examples: close the event loop at exit * More reliable CoroWrapper.__del__. If the constructor is interrupted by KeyboardInterrupt or the coroutine objet is destroyed lately, some the _source_traceback attribute doesn't exist anymore. * repr(Task): include also the future the task is waiting for
* Issue #21163: BaseEventLoop.run_until_complete() and test_utils.run_briefly()Victor Stinner2014-06-301-1/+4
| | | | | don't log the "destroy pending task" message anymore. The log is redundant for run_until_complete() and useless in run_briefly().
* asyncio: sync with Tulip, add a new asyncio.coroutines moduleVictor Stinner2014-06-281-135/+8
|
* asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task andVictor Stinner2014-06-271-3/+11
| | | | | | | | | | | Handle objects are created. Pass the traceback to call_exception_handler() in the 'source_traceback' key. The traceback is truncated to hide internal calls in asyncio, show only the traceback from user code. Add tests for the new source_traceback, and a test for the 'Future/Task exception was never retrieved' log.
* asyncio, Tulip issue 137: In debug mode, add the traceback where the coroutineVictor Stinner2014-06-271-7/+10
| | | | object was created to the "coroutine ... was never yield from" log
* asyncio, Tulip issue 177: Rewite repr() of Future, Task, Handle and TimerHandleVictor Stinner2014-06-251-20/+31
| | | | | | - Uniformize repr() output to format "<Class ...>" - On Python 3.5+, repr(Task) uses the qualified name instead of the short name of the coroutine
* asyncio: repr(Task) now also contains the line number even if the coroutine isVictor Stinner2014-06-241-2/+4
| | | | | | | | done: use the first line number of the code object instead of the current line number of the generator frame. The name of the coroutine is not enough because many coroutines may have the same name. It's a common case in asyncio tests for example.
* asyncio: Log an error if a Task is destroyed while it is still pendingVictor Stinner2014-06-241-0/+13
|
* asyncio: Set __qualname__ attribute of CoroWrapper in @coroutine decorator onVictor Stinner2014-06-171-4/+6
| | | | | | | | | | | Python 3.5 - Drop __slots__ optimization of CoroWrapper to be able to set the __qualname__ attribute. - Add tests on __name__, __qualname__ and __module__ of a coroutine function and coroutine object. - Fix test_tasks when run in debug mode (PYTHONASYNCIODEBUG env var set) on Python 3.3 or 3.4
* asyncio: Task.__repr__() now also handles CoroWrapperVictor Stinner2014-06-161-1/+1
|
* asyncio: Tulip issue 173: Enhance repr(Handle) and repr(Task)Victor Stinner2014-06-121-1/+9
| | | | | | | | | | repr(Handle) is shorter for function: "foo" instead of "<function foo at 0x...>". It now also includes the source of the callback, filename and line number where it was defined, if available. repr(Task) now also includes the current position in the code, filename and line number, if available. If the coroutine (generator) is done, the line number is omitted and "done" is added.
* Issue #21596: asyncio.wait(): mention that the sequence of futures must notVictor Stinner2014-06-101-0/+2
| | | | be empty.