From 24e837f23126eab7486a77f3cb51b982226adb70 Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Wed, 18 Mar 2015 17:27:57 -0700 Subject: 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 --- Lib/ssl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Lib/ssl.py') 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()} -- cgit v1.2.1