bpo-34282: Fix Enum._convert shadowing members named _convert (GH-8568)

* Fix enum members getting shadowed by parent attributes
* Move Enum._convert to EnumMeta._convert_
* Deprecate _convert
This commit is contained in:
orlnub123 2018-09-12 20:28:53 +03:00 committed by Ethan Furman
parent f52237400b
commit 0fb9fadd3b
7 changed files with 99 additions and 53 deletions

View file

@ -70,22 +70,22 @@ __all__.extend(os._get_exports_list(_socket))
# in this module understands the enums and translates them back from integers
# where needed (e.g. .family property of a socket object).
IntEnum._convert(
IntEnum._convert_(
'AddressFamily',
__name__,
lambda C: C.isupper() and C.startswith('AF_'))
IntEnum._convert(
IntEnum._convert_(
'SocketKind',
__name__,
lambda C: C.isupper() and C.startswith('SOCK_'))
IntFlag._convert(
IntFlag._convert_(
'MsgFlag',
__name__,
lambda C: C.isupper() and C.startswith('MSG_'))
IntFlag._convert(
IntFlag._convert_(
'AddressInfo',
__name__,
lambda C: C.isupper() and C.startswith('AI_'))