From faa135acbfcd55f79fb97f7525c8aa6f5a5b6a22 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 6 Oct 2017 02:08:57 -0400 Subject: bpo-31709: Drop support for asynchronous __aiter__. (#3903) --- Lib/asyncio/streams.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'Lib/asyncio/streams.py') diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index a82cc79aca..9fda853768 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -676,20 +676,12 @@ class StreamReader: self._maybe_resume_transport() return data - if compat.PY35: - @coroutine - def __aiter__(self): - return self - - @coroutine - def __anext__(self): - val = yield from self.readline() - if val == b'': - raise StopAsyncIteration - return val - - if compat.PY352: - # In Python 3.5.2 and greater, __aiter__ should return - # the asynchronous iterator directly. - def __aiter__(self): - return self + def __aiter__(self): + return self + + @coroutine + def __anext__(self): + val = yield from self.readline() + if val == b'': + raise StopAsyncIteration + return val -- cgit v1.2.1