aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-09-29 20:56:09 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-09-29 20:56:09 -0400
commit44878a53ec4994730ab6e0cb2e070398794718ab (patch)
treee17c6b263696bd762e91c2958244865e71295f83
parenta94f97ee8b32d35fc7ed02849a807fab58147dc5 (diff)
downloadcryptography-44878a53ec4994730ab6e0cb2e070398794718ab.tar.gz
cryptography-44878a53ec4994730ab6e0cb2e070398794718ab.tar.bz2
cryptography-44878a53ec4994730ab6e0cb2e070398794718ab.zip
use signature so stuff works on 3.6 -- fixes #2382
-rw-r--r--src/cryptography/utils.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index 237d5968..27bccbc6 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -58,6 +58,11 @@ class InterfaceNotImplemented(Exception):
pass
+if hasattr(inspect, "signature"):
+ signature = inspect.signature
+else:
+ signature = inspect.getargspec
+
def verify_interface(iface, klass):
for method in iface.__abstractmethods__:
if not hasattr(klass, method):
@@ -67,9 +72,9 @@ def verify_interface(iface, klass):
if isinstance(getattr(iface, method), abc.abstractproperty):
# Can't properly verify these yet.
continue
- spec = inspect.getargspec(getattr(iface, method))
- actual = inspect.getargspec(getattr(klass, method))
- if spec != actual:
+ sig = signature(getattr(iface, method))
+ actual = signature(getattr(klass, method))
+ if sig != actual:
raise InterfaceNotImplemented(
"{0}.{1}'s signature differs from the expected. Expected: "
"{2!r}. Received: {3!r}".format(