On 24/05/16 09:29 AM, Victor Stinner wrote:
the problem is that _SSLProtocolTransport.__del__() should be called first

You cannot control the order in which objects are destroyed.

The problem is that you don't close explictly this transport ;-)

No argument, but is a fatal error appropriate?
I expect merely a ResourceWarning.
Something like the following avoids the fatal error:


diff --git a/asyncio/selector_events.py b/asyncio/selector_events.py
index b34fee3..5a22412 100644
--- a/asyncio/selector_events.py
+++ b/asyncio/selector_events.py
@@ -575,6 +575,7 @@ def __del__(self):
             if self._sock is not None:
warnings.warn("unclosed transport %r" % self, ResourceWarning)
                 self._sock.close()
+                self._conn_lost += 1

     def _fatal_error(self, exc, message='Fatal error on transport'):
         # Should be called from exception handler only.

Reply via email to