This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients alex, asvetlov, bquinlan, christian.heimes, corona10, davin, dstufft, janssen, miss-islington, pitrou, serhiy.storchaka, vstinner, yselivanov
Date 2020-11-23.09:45:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606124738.8.0.133212841244.issue42413@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-11-23 09:45:38vstinnersetrecipients: + vstinner, bquinlan, janssen, pitrou, christian.heimes, alex, asvetlov, serhiy.storchaka, yselivanov, dstufft, davin, corona10, miss-islington
2020-11-23 09:45:38vstinnersetmessageid: <1606124738.8.0.133212841244.issue42413@roundup.psfhosted.org>
2020-11-23 09:45:38vstinnerlinkissue42413 messages
2020-11-23 09:45:38vstinnercreate