Skip to content

Commit

Permalink
Memory leak with aiohttp.request #1756
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Mar 27, 2017
1 parent f661718 commit 9cc598d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Changes
2.0.4 (2017-03-27)
------------------

- Memory leak with aiohttp.request #1756

- Encoding is always UTF-8 in POST data #1750

- Do not add "Content-Disposition" header by default #1755
Expand Down
6 changes: 3 additions & 3 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def __aexit__(self, exc_type, exc, tb):
yield from self._resp.close()


class _DetachedRequestContextManager(_RequestContextManager):
class _SessionRequestContextManager(_RequestContextManager):

__slots__ = _RequestContextManager.__slots__ + ('_session', )

Expand All @@ -682,7 +682,7 @@ def __await__(self):
raise

def __del__(self):
self._session.detach()
self._session.close()


def request(method, url, *,
Expand Down Expand Up @@ -746,7 +746,7 @@ def request(method, url, *,
loop=loop, cookies=cookies, version=version,
connector=connector, connector_owner=connector_owner)

return _DetachedRequestContextManager(
return _SessionRequestContextManager(
session._request(method, url,
params=params,
data=data,
Expand Down
1 change: 1 addition & 0 deletions aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def close(self):
if transport is not None:
transport.close()
self.transport = None
self._payload = None
return transport

def is_connected(self):
Expand Down

0 comments on commit 9cc598d

Please sign in to comment.