diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2015-03-19 00:27:57 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2015-03-19 00:27:57 (GMT) |
commit | 24e837f23126eab7486a77f3cb51b982226adb70 (patch) | |
tree | f73fe9872045e331ab42f6c34b2109620d9347f7 /Lib/ssl.py | |
parent | 8eef6a9ad04f6f81190f44ae3ded427e4083baa2 (diff) | |
download | cpython-24e837f23126eab7486a77f3cb51b982226adb70.zip cpython-24e837f23126eab7486a77f3cb51b982226adb70.tar.gz cpython-24e837f23126eab7486a77f3cb51b982226adb70.tar.bz2 |
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.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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()} |