Mention the lack of "errno" on select.error

This commit is contained in:
Antoine Pitrou 2011-05-12 18:09:06 +02:00
parent b143933fc2
commit 892e7810a6
1 changed files with 19 additions and 0 deletions

View File

@ -883,6 +883,25 @@ select
* epoll objects raise IOError; * epoll objects raise IOError;
* kqueue objects raise both OSError and 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 "<stdin>", line 1, in <module>
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 "<stdin>", line 1, in <module>
AttributeError: 'error' object has no attribute 'errno'
>>> e.args[0] == errno.EINTR
True
signal signal
'''''' ''''''