mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
remove __del__ because it's evil and also prevents the ResourceWarning on the socket from happening (closes #16900)
This commit is contained in:
parent
7bd04867e5
commit
36f7b97787
3 changed files with 10 additions and 4 deletions
|
@ -574,10 +574,6 @@ class SSLSocket(socket):
|
||||||
return None
|
return None
|
||||||
return self._sslobj.tls_unique_cb()
|
return self._sslobj.tls_unique_cb()
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
# sys.stderr.write("__del__ on %s\n" % repr(self))
|
|
||||||
self._real_close()
|
|
||||||
|
|
||||||
|
|
||||||
def wrap_socket(sock, keyfile=None, certfile=None,
|
def wrap_socket(sock, keyfile=None, certfile=None,
|
||||||
server_side=False, cert_reqs=CERT_NONE,
|
server_side=False, cert_reqs=CERT_NONE,
|
||||||
|
|
|
@ -374,6 +374,14 @@ class BasicSocketTests(unittest.TestCase):
|
||||||
ss = ssl.wrap_socket(s, server_side=True, certfile=CERTFILE)
|
ss = ssl.wrap_socket(s, server_side=True, certfile=CERTFILE)
|
||||||
self.assertIsNone(ss.get_channel_binding("tls-unique"))
|
self.assertIsNone(ss.get_channel_binding("tls-unique"))
|
||||||
|
|
||||||
|
def test_dealloc_warn(self):
|
||||||
|
ss = ssl.wrap_socket(socket.socket(socket.AF_INET))
|
||||||
|
r = repr(ss)
|
||||||
|
with self.assertWarns(ResourceWarning) as cm:
|
||||||
|
ss = None
|
||||||
|
support.gc_collect()
|
||||||
|
self.assertIn(r, str(cm.warning.args[0]))
|
||||||
|
|
||||||
class ContextTests(unittest.TestCase):
|
class ContextTests(unittest.TestCase):
|
||||||
|
|
||||||
@skip_if_broken_ubuntu_ssl
|
@skip_if_broken_ubuntu_ssl
|
||||||
|
|
|
@ -142,6 +142,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed.
|
||||||
|
|
||||||
- Issue #15545: Fix regression in sqlite3's iterdump method where it was
|
- Issue #15545: Fix regression in sqlite3's iterdump method where it was
|
||||||
failing if the connection used a row factory (such as sqlite3.Row) that
|
failing if the connection used a row factory (such as sqlite3.Row) that
|
||||||
produced unsortable objects. (Regression was introduced by fix for 9750).
|
produced unsortable objects. (Regression was introduced by fix for 9750).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue