diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index dc14e22ad121ba..a5ba49b321effe 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2812,7 +2812,7 @@ def test_tls1_3(self): ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2 ) with ThreadedEchoServer(context=context) as server: - with context.wrap_socket(socket.socket()) as s: + with closing(context.wrap_socket(socket.socket())) as s: s.connect((HOST, server.port)) self.assertIn(s.cipher()[0], [ 'TLS13-AES-256-GCM-SHA384',