summaryrefslogtreecommitdiff
path: root/redis/_compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/_compat.py')
-rw-r--r--redis/_compat.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/redis/_compat.py b/redis/_compat.py
index 307f3cc..26ee348 100644
--- a/redis/_compat.py
+++ b/redis/_compat.py
@@ -2,11 +2,6 @@
import errno
import sys
-try:
- InterruptedError = InterruptedError
-except:
- 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):
@@ -15,16 +10,14 @@ if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and
import time
import errno
- 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