enum auto must not be derived from IntFlag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
When using auto enumeration within an class Example(enum.Enum): X = auto(), the invokation of auto() is actually constructing an instance of enum.auto, which just has a default constructor without any extra arguments.
However, when deriving class auto(IntFlag) in enum.pyi the stub actually has a constructor argument of type int, the value for the IntFlag.
This contradicts the definition in the original enum.py implementation.
As a matter of fact this leads to confusing type hints, e.g. enum class auto(IntFlag).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the auto definition in enum.pyi with the original enum.py implementation mentioned in the issue. Check the constructor and inheritance shown in both files, then update the stub so its definition matches the implementation and no longer produces the confusing enum.auto(IntFlag) type hint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100