[Python-checkins] peps: Mention the lack of "errno" on select.error
antoine.pitrou
python-checkins at python.org
Thu May 12 18:09:08 CEST 2011
http://hg.python.org/peps/rev/1bc2e9bcea04
changeset: 3878:1bc2e9bcea04
user: Antoine Pitrou <solipsis at pitrou.net>
date: Thu May 12 18:09:06 2011 +0200
summary:
Mention the lack of "errno" on select.error
files:
pep-3151.txt | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/pep-3151.txt b/pep-3151.txt
--- a/pep-3151.txt
+++ b/pep-3151.txt
@@ -883,6 +883,25 @@
* 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
''''''
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list