summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-04 22:00:13 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-12-04 22:00:13 (GMT)
commitfe22e0985adae5ccfe230c815267fd410de59148 (patch)
tree004adb7fc3a3223faaabbf0f7e217aa7fd53bf86 /Lib/asyncio/tasks.py
parentbb37b4ca7341bc1f09996c4c7a1d59b32d80c5a6 (diff)
downloadcpython-fe22e0985adae5ccfe230c815267fd410de59148.zip
cpython-fe22e0985adae5ccfe230c815267fd410de59148.tar.gz
cpython-fe22e0985adae5ccfe230c815267fd410de59148.tar.bz2
asyncio: Initialize more Future and Task attributes in the class definition to
avoid attribute errors in destructors.
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index a2128c5..9aebffd 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -41,6 +41,10 @@ class Task(futures.Future):
# all running event loops. {EventLoop: Task}
_current_tasks = {}
+ # If False, don't log a message if the task is destroyed whereas its
+ # status is still pending
+ _log_destroy_pending = True
+
@classmethod
def current_task(cls, loop=None):
"""Return the currently running task in an event loop or None.
@@ -73,9 +77,6 @@ class Task(futures.Future):
self._must_cancel = False
self._loop.call_soon(self._step)
self.__class__._all_tasks.add(self)
- # If False, don't log a message if the task is destroyed whereas its
- # status is still pending
- self._log_destroy_pending = True
# On Python 3.3 or older, objects with a destructor that are part of a
# reference cycle are never destroyed. That's not the case any more on