Skip to content

Commit

Permalink
Close unclosed client sessions properly (#2523)
Browse files Browse the repository at this point in the history
* Close unclosed client sessions properly

* Add news fragment

* Drop it all together
  • Loading branch information
hynek authored and asvetlov committed Nov 17, 2017
1 parent 50da0d7 commit a40f63f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/2523.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix warning in `ClientSession.__del__` by stopping to try to close it.
2 changes: 0 additions & 2 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ def __init__(self, *, connector=None, loop=None, cookies=None,

def __del__(self, _warnings=warnings):
if not self.closed:
self.close()

_warnings.warn("Unclosed client session {!r}".format(self),
ResourceWarning)
context = {'client_session': self,
Expand Down

0 comments on commit a40f63f

Please sign in to comment.