-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enum auto must not be derived from IntFlag #8286
Comments
I agree that this is confusing an error prone. In the last few years we tend to align stubs as closely to the implementation as possible. In this case, I believe the best approach is for type checkers would be to special case That said, as a stop-gap we could try not to derive |
Also cf. #1331 for PR where the current implementation was added. |
What are you using the
The derived classes from |
+1 |
When using auto enumeration within an
class Example(enum.Enum): X = auto()
, the invokation ofauto()
is actually constructing an instance ofenum.auto
, which just has a default constructor without any extra arguments.However, when deriving
class auto(IntFlag)
inenum.pyi
the stub actually has a constructor argument of type int, the value for theIntFlag
.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)
.The text was updated successfully, but these errors were encountered: