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

@ -5,14 +5,12 @@ __all__ = ['Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore']
import collections
import sys
from . import compat
from . import events
from . import futures
from .coroutines import coroutine
_PY35 = sys.version_info >= (3, 5)
class _ContextManager:
"""Context manager.
@ -70,7 +68,7 @@ class _ContextManagerMixin:
yield from self.acquire()
return _ContextManager(self)
if _PY35:
if compat.PY35:
def __await__(self):
# To make "with await lock" work.