diff options
author | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-02-02 06:45:21 -0800 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-02-02 06:45:21 -0800 |
commit | 600dcc2e8ba0d02f19b68e84e1dc07a50cad83d2 (patch) | |
tree | 0e64b3b03c3e76d9c7158314bdaf7c7fbf5f9fb3 | |
parent | ce27d79ec1d93dd428d09f5e6df79b12534423a3 (diff) | |
parent | 410d04255a204d180650eaf86890e1b389a36dbc (diff) | |
download | pyopenssl-600dcc2e8ba0d02f19b68e84e1dc07a50cad83d2.tar.gz |
Merge pull request #20 from kouk/longint
Add support for file descriptors represented as `long` on Python 2.x. This fixes many failing tests on 64 bit Windows w/ 64 bit Python.
Also some other changes to make `memdbg` optional (it is pretty glibc-specific).
-rw-r--r-- | OpenSSL/SSL.py | 9 | ||||
-rw-r--r-- | OpenSSL/test/util.py | 6 | ||||
-rw-r--r-- | runtests.py | 5 |
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() |