diff options
| author | Andy McCurdy <andy@andymccurdy.com> | 2018-11-14 21:56:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-14 21:56:28 -0800 |
| commit | 35640aa31a70fe9eaf07512c69a601533fed130f (patch) | |
| tree | b8dcf3a66d99ee624c2eea1eb4ca185a8799cb32 | |
| parent | a32a01cf7b76ae0c8f711b639df6719d58393970 (diff) | |
| parent | d70319312460d2016153a75fcc20c7623cc612e2 (diff) | |
| download | redis-py-35640aa31a70fe9eaf07512c69a601533fed130f.tar.gz | |
Merge pull request #813 from lddubeau/fix/no-interruptederror-on-python-2.7
InterruptedError does not exist in Python < 3.3.
| -rw-r--r-- | redis/_compat.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/redis/_compat.py b/redis/_compat.py index 1ad0acc..80973b3 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -2,11 +2,6 @@ import errno import sys -try: - InterruptedError = InterruptedError -except NameError: - InterruptedError = OSError - # For Python older than 3.5, retry EINTR. if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 5): @@ -14,16 +9,14 @@ if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and import socket import time - from select import select as _select + from select import select as _select, error as select_error def select(rlist, wlist, xlist, timeout): while True: try: return _select(rlist, wlist, xlist, timeout) - except InterruptedError as e: - # Python 2 does not define InterruptedError, instead - # try to catch an OSError with errno == EINTR == 4. - if getattr(e, 'errno', None) == getattr(errno, 'EINTR', 4): + except select_error as e: + if e.args[0] == errno.EINTR: continue raise |
