summaryrefslogtreecommitdiff
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index d06828a620..dbe06c4a98 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -11,6 +11,7 @@ import reprlib
import sys
import traceback
+from . import compat
from . import events
# States for Future.
@@ -18,9 +19,6 @@ _PENDING = 'PENDING'
_CANCELLED = 'CANCELLED'
_FINISHED = 'FINISHED'
-_PY34 = sys.version_info >= (3, 4)
-_PY35 = sys.version_info >= (3, 5)
-
Error = concurrent.futures._base.Error
CancelledError = concurrent.futures.CancelledError
TimeoutError = concurrent.futures.TimeoutError
@@ -199,7 +197,7 @@ class Future:
# On Python 3.3 and older, objects with a destructor part of a reference
# cycle are never destroyed. It's not more the case on Python 3.4 thanks
# to the PEP 442.
- if _PY34:
+ if compat.PY34:
def __del__(self):
if not self._log_traceback:
# set_exception() was not called, or result() or exception()
@@ -352,7 +350,7 @@ class Future:
self._exception = exception
self._state = _FINISHED
self._schedule_callbacks()
- if _PY34:
+ if compat.PY34:
self._log_traceback = True
else:
self._tb_logger = _TracebackLogger(self, exception)
@@ -388,7 +386,7 @@ class Future:
assert self.done(), "yield from wasn't used with future"
return self.result() # May raise too.
- if _PY35:
+ if compat.PY35:
__await__ = __iter__ # make compatible with 'await' expression