Unify the unspecified argument thing.
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index 1215526..6dba10c 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -14,13 +14,12 @@
exception_from_error_queue as _exception_from_error_queue,
native as _native,
path_string as _path_string,
+ UNSPECIFIED as _UNSPECIFIED,
)
from OpenSSL.crypto import (
FILETYPE_PEM, _PassphraseHelper, PKey, X509Name, X509, X509Store)
-_unspecified = object()
-
try:
_memoryview = memoryview
except NameError:
@@ -559,7 +558,7 @@
raise exception
- def use_privatekey_file(self, keyfile, filetype=_unspecified):
+ def use_privatekey_file(self, keyfile, filetype=_UNSPECIFIED):
"""
Load a private key from a file
@@ -570,7 +569,7 @@
"""
keyfile = _path_string(keyfile)
- if filetype is _unspecified:
+ if filetype is _UNSPECIFIED:
filetype = FILETYPE_PEM
elif not isinstance(filetype, integer_types):
raise TypeError("filetype must be an integer")
diff --git a/OpenSSL/_util.py b/OpenSSL/_util.py
index 1eec17e..a4fe63a 100644
--- a/OpenSSL/_util.py
+++ b/OpenSSL/_util.py
@@ -93,3 +93,8 @@
else:
def byte_string(s):
return s
+
+
+# A marker object to observe whether some optional arguments are passed any
+# value or not.
+UNSPECIFIED = object()
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py
index 53a8dfc..4f0e7f2 100644
--- a/OpenSSL/crypto.py
+++ b/OpenSSL/crypto.py
@@ -14,7 +14,9 @@
lib as _lib,
exception_from_error_queue as _exception_from_error_queue,
byte_string as _byte_string,
- native as _native)
+ native as _native,
+ UNSPECIFIED as _UNSPECIFIED,
+)
FILETYPE_PEM = _lib.SSL_FILETYPE_PEM
FILETYPE_ASN1 = _lib.SSL_FILETYPE_ASN1
@@ -25,10 +27,6 @@
TYPE_RSA = _lib.EVP_PKEY_RSA
TYPE_DSA = _lib.EVP_PKEY_DSA
-# A marker object to observe whether some optional arguments are passed any
-# value or not.
-_undefined = object()
-
class Error(Exception):
@@ -1835,7 +1833,7 @@
def export(self, cert, key, type=FILETYPE_PEM, days=100,
- digest=_undefined):
+ digest=_UNSPECIFIED):
"""
export a CRL as a string
@@ -1862,7 +1860,7 @@
if not isinstance(type, int):
raise TypeError("type must be an integer")
- if digest is _undefined:
+ if digest is _UNSPECIFIED:
_warn(
"The default message digest (md5) is deprecated. "
"Pass the name of a message digest explicitly.",