From a40f63fcf4ab9181eaaf8ef1171235d12d5c0d73 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 17 Nov 2017 10:22:38 +0100 Subject: [PATCH] Close unclosed client sessions properly (#2523) * Close unclosed client sessions properly * Add news fragment * Drop it all together --- CHANGES/2523.bugfix | 1 + aiohttp/client.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 CHANGES/2523.bugfix diff --git a/CHANGES/2523.bugfix b/CHANGES/2523.bugfix new file mode 100644 index 00000000000..879ec21b378 --- /dev/null +++ b/CHANGES/2523.bugfix @@ -0,0 +1 @@ +Fix warning in `ClientSession.__del__` by stopping to try to close it. diff --git a/aiohttp/client.py b/aiohttp/client.py index 62b879449c6..d0d1e0a35fc 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -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,