aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index d3e845ab..48ed449a 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -31,6 +31,15 @@ def register_interface(iface):
return register_decorator
+def register_interface_if(predicate, iface):
+ def register_decorator(klass):
+ if predicate:
+ verify_interface(iface, klass)
+ iface.register(klass)
+ return klass
+ return register_decorator
+
+
if hasattr(int, "from_bytes"):
int_from_bytes = int.from_bytes
else: