File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -574,10 +574,6 @@ def get_channel_binding(self, cb_type="tls-unique"):
574574 return None
575575 return self ._sslobj .tls_unique_cb ()
576576
577- def __del__ (self ):
578- # sys.stderr.write("__del__ on %s\n" % repr(self))
579- self ._real_close ()
580-
581577
582578def wrap_socket (sock , keyfile = None , certfile = None ,
583579 server_side = False , cert_reqs = CERT_NONE ,
Original file line number Diff line number Diff line change @@ -374,6 +374,14 @@ def test_tls_unique_channel_binding(self):
374374 ss = ssl .wrap_socket (s , server_side = True , certfile = CERTFILE )
375375 self .assertIsNone (ss .get_channel_binding ("tls-unique" ))
376376
377+ def test_dealloc_warn (self ):
378+ ss = ssl .wrap_socket (socket .socket (socket .AF_INET ))
379+ r = repr (ss )
380+ with self .assertWarns (ResourceWarning ) as cm :
381+ ss = None
382+ support .gc_collect ()
383+ self .assertIn (r , str (cm .warning .args [0 ]))
384+
377385class ContextTests (unittest .TestCase ):
378386
379387 @skip_if_broken_ubuntu_ssl
Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ Core and Builtins
142142Library
143143-------
144144
145+ - Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed.
146+
145147- Issue #15545: Fix regression in sqlite3's iterdump method where it was
146148 failing if the connection used a row factory (such as sqlite3.Row) that
147149 produced unsortable objects. (Regression was introduced by fix for 9750).
You can’t perform that action at this time.
0 commit comments