New submission from Martin Panter: In bad_cert_test(), there are two OSError exception handler; one masking the other. In Python 3, I think we should remove the second (dead) handler. In Python 2, maybe the first OSError handler should catch socket.error instead.
Originally, in r80534, socket.error was caught and ignored, with the vague explanation “socket.error can really happen here”. Then revision 9297974604ff added an IOError handler, presumably to catch ENOENT for test_nonexisting_cert(). Later, in revisions 50d19c2fac82 and 9297974604ff, socket.error and IOError were both changed to OSError. I guess in Python 3 we should just catch all OSError exceptions and remove the second handler that only wants ENOENT. In Python 2, there was a large backport of SSL functionality in revision 221a1f9155e2 (Issue 21308). It seems to have brought too much of the OSError alias changes with it. This is probably the cause of the following 2.7 builtbot failure: http://buildbot.python.org/all/builders/x86%20XP-4%202.7/builds/3580/steps/test/logs/stdio ====================================================================== ERROR: test_nonexisting_cert (test.test_ssl.ThreadedTests) Connecting with a non-existing cert file ---------------------------------------------------------------------- Traceback (most recent call last): File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_ssl.py", line 2153, in test_nonexisting_cert "wrongcert.pem")) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_ssl.py", line 1889, in bad_cert_test s.connect((HOST, server.port)) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\ssl.py", line 844, in connect self._real_connect(addr, False) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\ssl.py", line 835, in _real_connect self.do_handshake() File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\ssl.py", line 808, in do_handshake self._sslobj.do_handshake() error: [Errno 10054] An existing connection was forcibly closed by the remote host Errno 10054 is apparently ECONNRESET. ---------- components: Tests keywords: buildbot messages: 258754 nosy: martin.panter priority: normal severity: normal stage: needs patch status: open title: test_ssl.bad_cert_test() exception handling versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26173> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com