[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, I tweaked the error message a bit: _sslobj can also be None when unwrap() has been called on the socket. Thank you for contribution! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed _

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset eda7e86bf03c by Antoine Pitrou in branch 'default': Issue #9177: Calling read() or write() now raises ValueError, not AttributeError, on a closed SSL socket. http://hg.python.org/cpython/rev/eda7e86bf03c -- nosy: +python-dev __

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor
STINNER Victor added the comment: Oops, remove "io.RawIOBase._checkClosed(self)" from my example (I read socket.py at the same time, SSLSocket inherits from socket, not from RawIOBase). -- ___ Python tracker __

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor
STINNER Victor added the comment: The check should be moved into the _checkClosed() method. Example: def _checkClosed(self): io.RawIOBase._checkClosed(self) if self._sslobj is None: raise ValueError("I/O operation on closed SSL socket") -- __

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor
STINNER Victor added the comment: ssl-socket-readwrite-after-close.diff: instead of testing "not self._sslobj", I would prefer an explicit "self._sslobj is None". -- nosy: +haypo ___ Python tracker

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the patch, I will take a look. -- stage: needs patch -> patch review versions: +Python 3.4 -Python 3.3 ___ Python tracker ___

[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-07 Thread Senko Rasic
Senko Rasic added the comment: Here's a patch that adds checks and ValueError raises to SSLSocket.read and SSLSocket.write. My first attempt was to add the check to _checkClosed to mirror the IOBase._checkClosed, but in SSLSocket its semantics are different (the idea is for the subclass to ad

[issue9177] ssl.read/write on closed socket raises AttributeError

2012-05-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't think mimicking EBADF is very useful. Reading from a closed socket is usually a programming error, so it's not the kind of error you'll want to catch at runtime. AttributeError may not be very pretty though, so perhaps a ValueError can be raised as w

[issue9177] ssl.read/write on closed socket raises AttributeError

2012-05-07 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, pitrou stage: -> needs patch versions: +Python 3.3 -Python 2.6, Python 3.1 ___ Python tracker ___ __

[issue9177] ssl.read/write on closed socket raises AttributeError

2010-07-06 Thread Cyril
New submission from Cyril : 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, i