[Python-bugs-list] [ python-Bugs-531145 ] socket.sslerror is not a socket.error

noreply@sourceforge.net noreply@sourceforge.net
Mon, 18 Mar 2002 12:23:50 -0800


Bugs item #531145, was opened at 2002-03-18 00:14
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=531145&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
>Priority: 3
Submitted By: Bastian Kleineidam (calvin)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.sslerror is not a socket.error

Initial Comment:
Python 2.1.2 (#1, Mar 16 2002, 00:56:55) 
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import socket
>>> socket.sslerror
<class socket.sslerror at 0x809c39c>
>>> try: raise socket.sslerror
... except socket.error: pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
socket.sslerror
>>> 


----------------------------------------------------------------------

>Comment By: Bastian Kleineidam (calvin)
Date: 2002-03-18 21:23

Message:
Logged In: YES 
user_id=9205

The documentation says for socket.error: "This exception is
raised for socket- or address-related errors." I think
socket.sslerror is such an error, because then you can write

try: sock.write("") # could be ssl-socket
except socket.error: pass

The other way would be
_exceptions = [socket.error]
if hasattr(socket, "sslerror"):
    _exceptions.append(socket.sslerror)
try: sock.write("")
except _exceptions: pass

Anyway, I assume this is a minor "bug".

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-18 11:44

Message:
Logged In: YES 
user_id=21627

Why is this a bug?

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=531145&group_id=5470