mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +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
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue