mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
asyncio: Add asyncio.compat module
Move compatibility helpers for the different Python versions to a new asyncio.compat module.
This commit is contained in:
parent
f05b79dbd2
commit
71080fc351
8 changed files with 35 additions and 30 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue