summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OpenSSL/SSL.py9
-rw-r--r--OpenSSL/test/util.py6
-rw-r--r--runtests.py5
3 files changed, 13 insertions, 7 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index 811c4de..81ec2e2 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -5,7 +5,7 @@ from weakref import WeakValueDictionary
from errno import errorcode
from six import text_type as _text_type
-
+from six import integer_types as integer_types
from OpenSSL._util import (
ffi as _ffi,
@@ -196,16 +196,15 @@ class _VerifyHelper(object):
def _asFileDescriptor(obj):
fd = None
-
- if not isinstance(obj, int):
+ if not isinstance(obj, integer_types):
meth = getattr(obj, "fileno", None)
if meth is not None:
obj = meth()
- if isinstance(obj, int):
+ if isinstance(obj, integer_types):
fd = obj
- if not isinstance(fd, int):
+ if not isinstance(fd, integer_types):
raise TypeError("argument must be an int, or have a fileno() method.")
elif fd < 0:
raise ValueError(
diff --git a/OpenSSL/test/util.py b/OpenSSL/test/util.py
index 011e7da..4e4d812 100644
--- a/OpenSSL/test/util.py
+++ b/OpenSSL/test/util.py
@@ -17,7 +17,11 @@ import sys
from OpenSSL._util import exception_from_error_queue
from OpenSSL.crypto import Error
-import memdbg
+try:
+ import memdbg
+except Exception:
+ class _memdbg(object): heap = None
+ memdbg = _memdbg()
from OpenSSL._util import ffi, lib, byte_string as b
diff --git a/runtests.py b/runtests.py
index 2ec425b..13f5c4c 100644
--- a/runtests.py
+++ b/runtests.py
@@ -2,7 +2,10 @@ import sys
sys.modules['ssl'] = None
sys.modules['_hashlib'] = None
-import memdbg
+try:
+ import memdbg
+except Exception as e:
+ pass
from twisted.scripts.trial import run
run()