[issue35899] '_is_sunder' function in 'enum' module fails on empty string

Ethan Furman report at bugs.python.org
Thu Feb 21 16:14:11 EST 2019


Ethan Furman <ethan at stoneleaf.us> added the comment:

The changes to `_is_sunder` and `_is_dunder` look good, but there is a problem with the underlying assumptions of what Enum should be doing:

- nameless members are not to be allowed
- non-alphanumeric characters are not supported

In other words, while `_is_sunder` should not fail, neither should an empty string be allowed as a member name.  This can be checked at line 154 (just add '' to the set) -- then double check that the error raised is a ValueError and not an IndexError.

For the strange character portion, use some non-latin numbers and letters to make sure they work, but don't check for symbols such as exclamation points -- while they might work, we are not supporting such things, and having a test that checks to make sure they work suggests that we do support it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35899>
_______________________________________


More information about the Python-bugs-list mailing list