New submission from Cyril <c...@excellency.fr>: This:
import socket, ssl s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_sock = ssl.wrap_socket(s) ssl_sock.connect(('www.verisign.com', 443)) ssl_sock.close() ssl_sock.read(1024) raises: Traceback (most recent call last): File "/tmp/bug.py", line 10, in <module> ssl_sock.read(1024) File "/path/to/lib/python2.7/ssl.py", line 138, in read return self._sslobj.read(len) AttributeError: 'NoneType' object has no attribute 'read' I would expect a socket.error instead, which mimics the way regular sockets behave. Indeed, this code: import socket, ssl s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('www.verisign.com', 80)) s.close() s.recv(1024) raises: Traceback (most recent call last): File "/tmp/bug.py", line 6, in <module> s.recv(1024) File "/path/to/lib/python2.7/socket.py", line 170, in _dummy raise error(EBADF, 'Bad file descriptor') socket.error: [Errno 9] Bad file descriptor I've tested on the latest trunks on both 2.7 and 3.2. I've also tested on 2.6 and 3.1. I can write a patch that fixes it if the bug is accepted. ---------- components: Library (Lib) messages: 109379 nosy: cbay priority: normal severity: normal status: open title: ssl.read/write on closed socket raises AttributeError type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9177> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com