From 9e171b794f102f5745076051202997df9eac254a Mon Sep 17 00:00:00 2001 From: Richard Mitchell Date: Tue, 29 Apr 2014 14:55:26 +0100 Subject: Get rid of catch-all exceptions. LP#1178485. --- lib/Crypto/SelfTest/Signature/test_pkcs1_15.py | 4 ++-- lib/Crypto/Util/py3compat.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py b/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py index cc94262..c2d60f8 100644 --- a/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py +++ b/lib/Crypto/SelfTest/Signature/test_pkcs1_15.py @@ -165,7 +165,7 @@ class PKCS1_15_Tests(unittest.TestCase): # Data to sign can either be in hex form or not try: h.update(t2b(row[1])) - except: + except ValueError: h.update(b(row[1])) # The real test signer = PKCS.new(key) @@ -186,7 +186,7 @@ class PKCS1_15_Tests(unittest.TestCase): # Data to sign can either be in hex form or not try: h.update(t2b(row[1])) - except: + except ValueError: h.update(b(row[1])) # The real test verifier = PKCS.new(key) diff --git a/lib/Crypto/Util/py3compat.py b/lib/Crypto/Util/py3compat.py index b8b89bf..1ab2206 100644 --- a/lib/Crypto/Util/py3compat.py +++ b/lib/Crypto/Util/py3compat.py @@ -75,7 +75,7 @@ if sys.version_info[0] == 2: def tobytes(s): try: return s.encode('latin-1') - except: + except UnicodeError: return ''.join(s) def tostr(bs): return unicode(bs, 'latin-1') -- cgit v1.2.1