summaryrefslogtreecommitdiff
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2015-03-18 17:27:57 -0700
committerEthan Furman <ethan@stoneleaf.us>2015-03-18 17:27:57 -0700
commit24e837f23126eab7486a77f3cb51b982226adb70 (patch)
treef73fe9872045e331ab42f6c34b2109620d9347f7 /Lib/ssl.py
parent8eef6a9ad04f6f81190f44ae3ded427e4083baa2 (diff)
downloadcpython-git-24e837f23126eab7486a77f3cb51b982226adb70.tar.gz
issue23673
add private method to enum to support replacing global constants with Enum members: - search for candidate constants via supplied filter - create new enum class and members - insert enum class and replace constants with members via supplied module name - replace __reduce_ex__ with function that returns member name, so previous Python versions can unpickle modify IntEnum classes to use new method
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 18730cb2e9..ab7a49b576 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -126,10 +126,10 @@ from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN
from _ssl import _OPENSSL_API_VERSION
-_SSLMethod = _IntEnum('_SSLMethod',
- {name: value for name, value in vars(_ssl).items()
- if name.startswith('PROTOCOL_')})
-globals().update(_SSLMethod.__members__)
+_IntEnum._convert(
+ '_SSLMethod', __name__,
+ lambda name: name.startswith('PROTOCOL_'),
+ source=_ssl)
_PROTOCOL_NAMES = {value: name for name, value in _SSLMethod.__members__.items()}