Skip to content

Commit c13be49

Browse files
Remove old backwards-compatibility stub (#8596)
1 parent 3b4cf01 commit c13be49

File tree

9 files changed

+159
-169
lines changed

9 files changed

+159
-169
lines changed

CHANGES/8596.breaking.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed old async compatibility from ``ClientResponse.release()`` -- by :user:`Dreamsorcerer`.

aiohttp/client_reqrep.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
basicauth_from_netrc,
5151
is_expected_content_type,
5252
netrc_from_env,
53-
noop,
5453
parse_mimetype,
5554
reify,
5655
set_exception,
@@ -993,15 +992,14 @@ def close(self) -> None:
993992
self._connection.close()
994993
self._connection = None
995994

996-
def release(self) -> Any:
995+
def release(self) -> None:
997996
if not self._released:
998997
self._notify_content()
999998

1000999
self._closed = True
10011000

10021001
self._cleanup_writer()
10031002
self._release_connection()
1004-
return noop()
10051003

10061004
@property
10071005
def ok(self) -> bool:

aiohttp/helpers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
Callable,
3131
ContextManager,
3232
Dict,
33-
Generator,
3433
Generic,
3534
Iterable,
3635
Iterator,
@@ -109,11 +108,6 @@
109108
TOKEN = CHAR ^ CTL ^ SEPARATORS
110109

111110

112-
class noop:
113-
def __await__(self) -> Generator[None, None, None]:
114-
yield
115-
116-
117111
json_re = re.compile(r"(?:application/|[\w.-]+/[\w.+-]+?\+)json$", re.IGNORECASE)
118112

119113

aiohttp/multipart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async def release(self) -> None:
247247
248248
All remaining content is read to the void.
249249
"""
250-
await self.resp.release()
250+
self.resp.release()
251251

252252

253253
class BodyPartReader:

tests/test_client_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ async def handler(request):
546546

547547
jar.update_cookies.reset_mock()
548548
resp = await session.get("/")
549-
await resp.release()
549+
resp.release()
550550

551551
# Filtering the cookie jar before sending the request,
552552
# getting the request URL as only parameter

tests/test_multipart.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ async def test_next(self) -> None:
107107

108108
async def test_release(self) -> None:
109109
wrapper = MultipartResponseWrapper(mock.Mock(), mock.Mock())
110-
wrapper.resp.release = make_mocked_coro(None)
111110
await wrapper.release()
112111
assert wrapper.resp.release.called
113112

114113
async def test_release_when_stream_at_eof(self) -> None:
115114
wrapper = MultipartResponseWrapper(mock.Mock(), mock.Mock())
116-
wrapper.resp.release = make_mocked_coro(None)
117115
wrapper.stream.next = make_mocked_coro(b"")
118116
wrapper.stream.at_eof.return_value = True
119117
await wrapper.next()

0 commit comments

Comments
 (0)