python / python/mypy

`enum.Enum` should not be callable

Open
#20,266 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-enum
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

enum.Enum shouldn't be callable

To Reproduce

import enum

enum.Enum()

Expected Behavior

Error about calling enum.Enum. Here's runtime output:

Traceback (most recent call last):
  File "/Users/a5rocks/Documents/mypy/repro.py", line 3, in <module>
    enum.Enum()
    ~~~~~~~~~^^
TypeError: EnumType.__call__() missing 1 required positional argument: 'value'

Actual Behavior

No errors.

Your Environment

  • Mypy version used: 1.19.0+dev.35e843cc38cedc1bdf87d9937c06d51189ad0e45
  • Mypy command-line flags: --cache-dir /dev/null
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.13.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported enum.Enum() reproduction and run mypy with --cache-dir /dev/null to confirm the missing diagnostic. Trace the callable handling for enum.Enum, then add a regression test showing that calling it is rejected while valid enum usage remains accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.