Use InterruptedError instead of checking for EINTR

This commit is contained in:
Antoine Pitrou 2011-10-23 23:49:42 +02:00
parent dcbb822c08
commit 24d659daaf
6 changed files with 17 additions and 38 deletions

View file

@ -327,15 +327,12 @@ class ForkAwareLocal(threading.local):
# Automatic retry after EINTR
#
def _eintr_retry(func, _errors=(EnvironmentError, select.error)):
def _eintr_retry(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
while True:
try:
return func(*args, **kwargs)
except _errors as e:
# select.error has no `errno` attribute
if e.args[0] == errno.EINTR:
continue
raise
except InterruptedError:
continue
return wrapped