Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f86b3c3

Browse files
committed
merge 3.3 (#16900)
2 parents 96983af + 36f7b97 commit f86b3c3

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

Lib/ssl.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff 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

612608
def wrap_socket(sock, keyfile=None, certfile=None,
613609
server_side=False, cert_reqs=CERT_NONE,

Lib/test/test_ssl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
386394
class ContextTests(unittest.TestCase):
387395

388396
@skip_if_broken_ubuntu_ssl

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ Core and Builtins
212212
Library
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).

0 commit comments

Comments
 (0)