From 892e7810a67f2dbff5a729f7f341dfc952aa50fd Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 12 May 2011 18:09:06 +0200 Subject: [PATCH] Mention the lack of "errno" on select.error --- pep-3151.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pep-3151.txt b/pep-3151.txt index bd00d887d..a3503b9d6 100644 --- a/pep-3151.txt +++ b/pep-3151.txt @@ -883,6 +883,25 @@ select * epoll objects raise IOError; * kqueue objects raise both OSError and IOError. +As a side-note, not deriving from ``EnvironmentError`` means ``select.error`` +does not get the useful ``errno`` attribute. User code must check ``args[0]`` +instead:: + + >>> signal.alarm(1); select.select([], [], []) + 0 + Traceback (most recent call last): + File "", line 1, in + select.error: (4, 'Interrupted system call') + >>> e = sys.last_value + >>> e + error(4, 'Interrupted system call') + >>> e.errno == errno.EINTR + Traceback (most recent call last): + File "", line 1, in + AttributeError: 'error' object has no attribute 'errno' + >>> e.args[0] == errno.EINTR + True + signal ''''''