Skip to content

Commit

Permalink
Merge pull request #1 from x0day/fix-socket-error
Browse files Browse the repository at this point in the history
fix socket.error raises
  • Loading branch information
x0day committed Sep 16, 2021
2 parents d9519df + fb6c366 commit 1a5d355
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aioredis/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
ssl.SSLError: 2,
}

# In Python 2.7 a socket.error is raised for a nonblocking read.
# The _compat module aliases BlockingIOError to socket.error to be
# Python 2/3 compatible.
# However this means that all socket.error exceptions need to be handled
# properly within these exception handlers.
# We need to make sure socket.error is included in these handlers and
# provide a dummy error number that will never match a real exception.
if socket.error not in NONBLOCKING_EXCEPTION_ERROR_NUMBERS:
NONBLOCKING_EXCEPTION_ERROR_NUMBERS[socket.error] = -999999

NONBLOCKING_EXCEPTIONS = tuple(NONBLOCKING_EXCEPTION_ERROR_NUMBERS.keys())

try:
Expand Down

0 comments on commit 1a5d355

Please sign in to comment.