Files
typeshed/stdlib
fedor e8e74ba26f Use object for value annotation in Enum.__new__ (#7752)
This pull request reverts part of #2539 that brought back a bug discussed in https://github.com/python/mypy/issues/5788 and initially fixed in #2539

In short, the issue was that the following program always resulted
in an error when running mypy with the `--disallow-any-expr` flag:

    from enum import Enum

    class MyEnum(Enum):
        FOO = 1
        BAR = 2

    blah = MyEnum   # Error here

The root issue was that because the signature of Enum's
`__new__` method was typed as:

    def __new__(self: Type[T], value: Any) -> T: ...

This caused mypy to decide that the type of `MyEnum` was
`(Any) -> MyEnum`. This is correct based on the current
type signature, but unfortunately means that it becomes
impossible to ever use enums with the `--disallow-any-expr` flag.
2022-04-30 12:36:35 -06:00
..
2021-05-06 18:57:33 +03:00
2022-02-19 12:25:51 -08:00
2022-02-19 12:26:45 -08:00
2022-02-19 12:27:07 -08:00
2022-01-30 16:27:06 -08:00
2022-02-22 20:12:43 +02:00
2022-04-18 21:21:19 +03:00
2022-04-01 18:01:23 +01:00
2022-02-18 01:27:28 -08:00
2022-01-30 16:27:06 -08:00
2022-04-17 01:01:36 +01:00
2022-04-23 18:28:35 -07:00
2021-12-22 20:18:19 -08:00
2021-12-22 20:18:19 -08:00
2021-12-22 20:18:19 -08:00
2022-01-01 14:19:05 +02:00
2022-03-03 15:25:30 -08:00
2022-02-19 19:57:43 -08:00