diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-28 14:43:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-28 14:43:52 +0100 |
commit | 3f438a9fa0aab5a598b4c94bbc24f9d0a23d012e (patch) | |
tree | a56013ffbf9cd0c3371f3c73e35bd966b6def7f0 /Lib/asyncio/locks.py | |
parent | a10dc3efcbba8aa7cc7d1a017f8b22fc4fa8e87c (diff) | |
download | cpython-git-3f438a9fa0aab5a598b4c94bbc24f9d0a23d012e.tar.gz |
asyncio: Remove asyncio/compat.py (#4606)
The asyncio/compat.py file was written to support Python < 3.5 and
Python < 3.5.2. But Python 3.5 doesn't accept bugfixes anymore, only
security fixes. There is no more need to backport bugfixes to Python
3.5, and so no need to have a single code base for Python 3.5, 3.6
and 3.7.
Say hello (again) to "async" and "await", who became real keywords in
Python 3.7 ;-)
Diffstat (limited to 'Lib/asyncio/locks.py')
-rw-r--r-- | Lib/asyncio/locks.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index 92661830a0..750c435917 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -4,7 +4,6 @@ __all__ = ['Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore'] import collections -from . import compat from . import events from . import futures from .coroutines import coroutine @@ -67,23 +66,21 @@ class _ContextManagerMixin: yield from self.acquire() return _ContextManager(self) - if compat.PY35: - - def __await__(self): - # To make "with await lock" work. - yield from self.acquire() - return _ContextManager(self) + def __await__(self): + # To make "with await lock" work. + yield from self.acquire() + return _ContextManager(self) - @coroutine - def __aenter__(self): - yield from self.acquire() - # We have no use for the "as ..." clause in the with - # statement for locks. - return None + @coroutine + def __aenter__(self): + yield from self.acquire() + # We have no use for the "as ..." clause in the with + # statement for locks. + return None - @coroutine - def __aexit__(self, exc_type, exc, tb): - self.release() + @coroutine + def __aexit__(self, exc_type, exc, tb): + self.release() class Lock(_ContextManagerMixin): |