Merge lp:~adeuring/lp-dev-utils/select.error-withour-errno-attr into lp:lp-dev-utils
Status: | Merged |
---|---|
Approved by: | j.c.sackett |
Approved revision: | 129 |
Merged at revision: | 129 |
Proposed branch: | lp:~adeuring/lp-dev-utils/select.error-withour-errno-attr |
Merge into: | lp:lp-dev-utils |
Diff against target: |
16 lines (+5/-1) 1 file modified
ec2test/instance.py (+5/-1) |
To merge this branch: | bzr merge lp:~adeuring/lp-dev-utils/select.error-withour-errno-attr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
j.c.sackett (community) | Approve | ||
Review via email:
|
Description of the change
This morning I got an AttributeError while trying to start an EC2 test. The error occured in line 669 of ec2test/
665 while 1:
666 try:
667 select.
668 except (IOError, select.error), e:
669 if e.errno == errno.EINTR:
670 continue
Poking around in the C source of the select module showed that select.error exceptions are always raised by calling PyErr_SetFromEr
"This is a convenience function to raise an exception when a C library function has returned an error and set the C variable errno. It constructs a tuple object whose first item is the integer errno value and whose second item is the corresponding error message..."
So, no attribute named "value". But e[0] is an integer with the value of the C errno variable.
I left the old attempt to access e.errno in the code because I don't know if some older version of Python may have generated a error object with the attribute errno.
Looks good. Thanks Abel.