summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2013-10-07 00:19:54 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2013-10-07 00:19:54 (GMT)
commit648f860c227187d01f00934e2e9453b32241bdaf (patch)
treeab61715c93a51bf30082a4704ad234d73da22677 /Lib/enum.py
parentab5a58d82732d94314160407112d8c609b7ad86b (diff)
downloadcpython-648f860c227187d01f00934e2e9453b32241bdaf.zip
cpython-648f860c227187d01f00934e2e9453b32241bdaf.tar.gz
cpython-648f860c227187d01f00934e2e9453b32241bdaf.tar.bz2
Close #19156: add tests and fix for Enum helper edge cases. Patch from CliffM.
Diffstat (limited to 'Lib/enum.py')
-rw-r--r--Lib/enum.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 921d00c..7ca8503 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -17,14 +17,16 @@ def _is_dunder(name):
"""Returns True if a __dunder__ name, False otherwise."""
return (name[:2] == name[-2:] == '__' and
name[2:3] != '_' and
- name[-3:-2] != '_')
+ name[-3:-2] != '_' and
+ len(name) > 4)
def _is_sunder(name):
"""Returns True if a _sunder_ name, False otherwise."""
return (name[0] == name[-1] == '_' and
name[1:2] != '_' and
- name[-2:-1] != '_')
+ name[-2:-1] != '_' and
+ len(name) > 2)
def _make_class_unpicklable(cls):