summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/enum.py')
-rw-r--r--Lib/enum.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 9c0af9e..c207dc2 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -739,6 +739,11 @@ class EnumType(type):
value = (value, names) + values
return cls.__new__(cls, value)
# otherwise, functional API: we're creating a new Enum type
+ if names is None and type is None:
+ # no body? no data-type? possibly wrong usage
+ raise TypeError(
+ f"{cls} has no members; specify `names=()` if you meant to create a new, empty, enum"
+ )
return cls._create_(
class_name=value,
names=names,