mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Use InterruptedError instead of checking for EINTR
This commit is contained in:
parent
dcbb822c08
commit
24d659daaf
6 changed files with 17 additions and 38 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue