[New-bugs-announce] [issue29980] OSError: multiple exceptions should preserve the exception type if it is common

R. David Murray report at bugs.python.org
Tue Apr 4 13:12:21 EDT 2017


New submission from R. David Murray:

create_connection will try multiple times to connect if there are multiple addresses returned by getaddrinfo.  If all connections file it inspects the exceptions, and raises the first one if they are all equal.  But since the addresses are often different (else why would we try multiple times?), the messages will usually be different.  When the messages are different, the code raises an OSError with a list of the exceptions so the user can see them all.  This, however, looses the information as to *what* kind of exception occurred (ie: ConnectioRefusedError, etc).

I propose that if all of the exceptions raised are of the same subclass, that that subclass be raised with the multi-message list, rather than the base OSError.

----------
components: asyncio
messages: 291126
nosy: r.david.murray, yselivanov
priority: normal
severity: normal
status: open
title: OSError: multiple exceptions should preserve the exception type if it is common

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29980>
_______________________________________


More information about the New-bugs-announce mailing list