From 53772852558ae744c624c47d143e6e0506cd6aa3 Mon Sep 17 00:00:00 2001 From: Andy McCurdy Date: Fri, 11 Oct 2019 10:46:51 -0700 Subject: [PATCH] Version 3.3.11 check exception.args rather than exception.message. exception.message was deprecated prior to Python 2.7 and some alternative builds have removed it completely. --- CHANGES | 3 +++ redis/__init__.py | 2 +- redis/_compat.py | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1aee24b0fe..73d2d4e05e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +* 3.3.11 + * Further fix for the SSLError -> TimeoutError mapping to work + on obscure releases of Python 2.7. * 3.3.10 * Fixed a potential error handling bug for the SSLError -> TimeoutError mapping introduced in 3.3.9. hanks @zbristow. #1224 diff --git a/redis/__init__.py b/redis/__init__.py index cfe7078455..5539ce0c89 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -29,7 +29,7 @@ def int_or_str(value): return value -__version__ = '3.3.10' +__version__ = '3.3.11' VERSION = tuple(map(int_or_str, __version__.split('.'))) __all__ = [ diff --git a/redis/_compat.py b/redis/_compat.py index 566945479d..2a4b2b9956 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -98,7 +98,8 @@ def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except _SSLError as e: - if any(x in e.message for x in _EXPECTED_SSL_TIMEOUT_MESSAGES): + message = len(e.args) == 1 and unicode(e.args[0]) or '' + if any(x in message for x in _EXPECTED_SSL_TIMEOUT_MESSAGES): # Raise socket.timeout for compatibility with Python 3. raise socket.timeout(*e.args) raise