asyncio: Add asyncio.compat module

Move compatibility helpers for the different Python versions to a new
asyncio.compat module.
This commit is contained in:
Victor Stinner 2015-07-25 02:23:21 +02:00
parent f05b79dbd2
commit 71080fc351
8 changed files with 35 additions and 30 deletions

View file

@ -9,14 +9,12 @@ import sys
import traceback
import types
from . import compat
from . import events
from . import futures
from .log import logger
_PY35 = sys.version_info >= (3, 5)
# Opcode of "yield from" instruction
_YIELD_FROM = opcode.opmap['YIELD_FROM']
@ -140,7 +138,7 @@ class CoroWrapper:
def gi_code(self):
return self.gen.gi_code
if _PY35:
if compat.PY35:
__await__ = __iter__ # make compatible with 'await' expression