New submission from Antoine Pitrou <[email protected]>:
When you call socket.create_connection() and it fails because it hits the
socket timeout, the socket.timeout error is recast as a generic socket.error,
which makes analyzing the failure more difficult (also, it means the "errno"
attribute is lost for other types of errors):
>>> socket.setdefaulttimeout(0.000001)
>>> s = socket.socket()
>>> s.connect(("www.yahoo.fr", 80))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.timeout: timed out
>>> socket.create_connection(("www.yahoo.fr", 80))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/antoine/py3k/__svn__/Lib/socket.py", line 319, in
create_connection
raise err
socket.error: timed out
----------
components: Library (Lib)
messages: 115798
nosy: exarkun, facundobatista, giampaolo.rodola, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: create_connection() recasts timeout errors
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com