This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients ethan.furman, orlnub123
Date 2018-08-31.10:01:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535709702.87.0.56676864532.issue34282@psf.upfronthosting.co.za>
In-reply-to
Content
For versions 3.6 and 3.7 the solution is to modify the shadow check at line 236 so only DynamicClassAttributes are /not/ shadowed (meaning the _convert method would be shadowed by an _convert member).

For 3.8 we can move _convert to the metaclass: I wasn't originally supportive of this idea, but I can see it being useful for other Enum mix-ins such as str.  However, I will want to include a check that such a mix-in is there -- probably by checking that the Enum type is a subclass of the first member's type... something like:

    if not issubclass(cls, members[0]):
       raise TypeError(...)

While we're making that change we can also check that members is not empty and issue a friendlier error message.

We can also rename _convert to _convert_ in 3.8, but we'll need to have _convert also on the metaclass and have it trigger a warning that _convert_ is now the right way, and _convert will go away in 3.9.
History
Date User Action Args
2018-08-31 10:01:42ethan.furmansetrecipients: + ethan.furman, orlnub123
2018-08-31 10:01:42ethan.furmansetmessageid: <1535709702.87.0.56676864532.issue34282@psf.upfronthosting.co.za>
2018-08-31 10:01:42ethan.furmanlinkissue34282 messages
2018-08-31 10:01:42ethan.furmancreate