]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
asyncio: document Task.current_task()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 10 Dec 2013 11:14:50 +0000 (12:14 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 10 Dec 2013 11:14:50 +0000 (12:14 +0100)
Doc/library/asyncio-task.rst

index 5769e9152010ca1edd1b927cb883abd711d90a9d..9581188e0e5b16e56945ea5e242f969565c6a655 100644 (file)
@@ -273,6 +273,14 @@ Task
 
       By default all tasks for the current event loop are returned.
 
+   .. classmethod:: current_task(loop=None)
+
+      Return the currently running task in an event loop or ``None``.
+
+      By default the current task for the current event loop is returned.
+
+      ``None`` is returned when called not in the context of a :class:`Task`.
+
    .. method:: cancel()
 
       Cancel the task.