File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -604,10 +604,6 @@ def get_channel_binding(self, cb_type="tls-unique"):
604604 return None
605605 return self ._sslobj .tls_unique_cb ()
606606
607- def __del__ (self ):
608- # sys.stderr.write("__del__ on %s\n" % repr(self))
609- self ._real_close ()
610-
611607
612608def wrap_socket (sock , keyfile = None , certfile = None ,
613609 server_side = False , cert_reqs = CERT_NONE ,
Original file line number Diff line number Diff line change @@ -383,6 +383,14 @@ def test_tls_unique_channel_binding(self):
383383 ss = ssl .wrap_socket (s , server_side = True , certfile = CERTFILE )
384384 self .assertIsNone (ss .get_channel_binding ("tls-unique" ))
385385
386+ def test_dealloc_warn (self ):
387+ ss = ssl .wrap_socket (socket .socket (socket .AF_INET ))
388+ r = repr (ss )
389+ with self .assertWarns (ResourceWarning ) as cm :
390+ ss = None
391+ support .gc_collect ()
392+ self .assertIn (r , str (cm .warning .args [0 ]))
393+
386394class ContextTests (unittest .TestCase ):
387395
388396 @skip_if_broken_ubuntu_ssl
Original file line number Diff line number Diff line change @@ -212,6 +212,8 @@ Core and Builtins
212212Library
213213-------
214214
215+ - Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed.
216+
215217- Issue #15545: Fix regression in sqlite3's iterdump method where it was
216218 failing if the connection used a row factory (such as sqlite3.Row) that
217219 produced unsortable objects. (Regression was introduced by fix for 9750).
You can’t perform that action at this time.
0 commit comments