New submission from STINNER Victor: Attached patch modifies Lib/test/test_ssl.py to use "with socket:" instead of "try: ... finally: socket.close()" or similar patterns.
Our PPC64 AIX 3.x buildbot has a broken ssl module. A lot of tests logs ResourceWarning on unclosed sockets, because errors occur before the test closes a socket. http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/4714/steps/test/logs/stdio test_connect_ex_error (test.test_ssl.NetworkedTests) ... ok test_connect_with_context (test.test_ssl.NetworkedTests) ... FAIL /home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/unittest/case.py:628: ResourceWarning: unclosed <ssl.SSLSocket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('140.211.15.154', 60379), raddr=('23.253.148.168', 443)> outcome.errors.clear() ---------- files: test_ssl_with.patch keywords: patch messages: 262222 nosy: haypo priority: normal severity: normal status: open title: test_ssl: use context manager (with) to fix ResourceWarning versions: Python 3.6 Added file: http://bugs.python.org/file42245/test_ssl_with.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26612> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com