Mention the lack of "errno" on select.error
This commit is contained in:
parent
b143933fc2
commit
892e7810a6
19
pep-3151.txt
19
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 "<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
|
||||
''''''
|
||||
|
||||
|
|
Loading…
Reference in New Issue