STINNER Victor <vstin...@python.org> added the comment:

IMHO it's ok that exc.errno is None. It doesn't prevent to write code like:

except OSError as exc:
    if exc.errno == ...:
        ...
    else:
        ...

In the early days (first 5 years? :-D) of the asyncio documentation, 
TimeoutError was documented just as "TimeoutError", instead of 
"asyncio.TimeoutError". So if you followed carefully the asyncio documentation 
and wrote "except TimeoutError:", the except would never be reached beause 
asyncio.TimeoutError is *not* a subclass of the builtin Timeout...

>>> issubclass(asyncio.TimeoutError, TimeoutError)
False

It would be great to have a single TimeoutError class. I'm fine with having 
weird attributes depending who raise the exception. Honestly, in most cases 
"except TimeoutError:" is enough: there is no need to check for exception 
attributes.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42413>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to