From f966b64f92b99f57dbcab1a870e022da03d81aa0 Mon Sep 17 00:00:00 2001 From: Andy McCurdy Date: Tue, 30 Jul 2019 14:01:23 -0700 Subject: Version 3.3.3. Accomodate Python 2.7.x versions < 2.7.9. The SSL module includes in Python versions < 2.7.9 does not include the SSLWantReadError or SSLWantWriteError exceptions. As such we can't assume they are present just because the ssl module happens to be installed. Fixes #1197 --- CHANGES | 3 +++ redis/__init__.py | 2 +- redis/connection.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 8c29266..53786d0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +* 3.3.3 + * The SSL module in Python < 2.7.9 handles non-blocking sockets + differently than 2.7.9+. This patch accomodates older versions. #1197 * 3.3.2 * Further fixed a regression introduced in 3.3.0 involving SSL and non-blocking sockets. #1197 diff --git a/redis/__init__.py b/redis/__init__.py index 234bd65..2d586c6 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -29,7 +29,7 @@ def int_or_str(value): return value -__version__ = '3.3.2' +__version__ = '3.3.3' VERSION = tuple(map(int_or_str, __version__.split('.'))) __all__ = [ diff --git a/redis/connection.py b/redis/connection.py index 46d3b20..e753bcb 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -34,9 +34,9 @@ try: except ImportError: ssl_available = False -if ssl_available: +if ssl_available and hasattr(ssl, 'SSLWantReadError'): # note that when using nonblocking sockets over ssl, the ssl module - # raises its own exceptions rather than the normal BlockingIOError + # in python > 2.7.9 raises its own exceptions rather than BlockingIOError blocking_exceptions = ( BlockingIOError, ssl.SSLWantReadError, -- cgit v1.2.1