3
""" Get the error code out of socket.error objects.
4
socket.error in <2.5 does not have errno attribute
5
socket.error in 3.x does not allow indexing access
6
e.args[0] works for all.
7
There are cases when args[0] is not errno.
8
i.e. http://bugs.python.org/issue6471
9
Maybe there are cases when errno is set, but it is not the first argument?
13
if exc.errno is not None: return exc.errno
14
except AttributeError:
21
if sys.version_info[0]<3:
22
from sys import exc_clear as clear_sys_exc_info
24
def clear_sys_exc_info():
26
Exception information is not visible outside of except statements.
27
sys.exc_clear became obsolete and removed."""
30
if sys.version_info[0]==2 and sys.version_info[1]<5:
31
class BaseException: # pylint: disable-msg=W0622
32
# not subclassing from object() intentionally, because in
33
# that case "raise Timeout" fails with TypeError.
36
from __builtin__ import BaseException