summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OpenSSL/_util.py9
-rw-r--r--OpenSSL/test/test_crypto.py2
2 files changed, 7 insertions, 4 deletions
diff --git a/OpenSSL/_util.py b/OpenSSL/_util.py
index 7c606b9..baeecc6 100644
--- a/OpenSSL/_util.py
+++ b/OpenSSL/_util.py
@@ -6,15 +6,18 @@ ffi = binding.ffi
lib = binding.lib
def exception_from_error_queue(exceptionType):
+ def text(charp):
+ return native(ffi.string(charp))
+
errors = []
while True:
error = lib.ERR_get_error()
if error == 0:
break
errors.append((
- ffi.string(lib.ERR_lib_error_string(error)),
- ffi.string(lib.ERR_func_error_string(error)),
- ffi.string(lib.ERR_reason_error_string(error))))
+ text(lib.ERR_lib_error_string(error)),
+ text(lib.ERR_func_error_string(error)),
+ text(lib.ERR_reason_error_string(error))))
raise exceptionType(errors)
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index 51da99b..4e42f70 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -1941,7 +1941,7 @@ class PKCS12Tests(TestCase):
"""
passwd = 'whatever'
e = self.assertRaises(Error, load_pkcs12, b'fruit loops', passwd)
- self.assertEqual( e.args[0][0][0], b'asn1 encoding routines')
+ self.assertEqual( e.args[0][0][0], 'asn1 encoding routines')
self.assertEqual( len(e.args[0][0]), 3)