dataclasses.make_dataclass
should accept Any, not type
#11653
Labels
help wanted
An actionable problem of low to medium complexity where a PR would be very welcome
stubs: false positive
Type checkers report false errors
It has been reported before about
UnionType
vstype
. The original bug mentioned something like:Resulting in:
The issue has been dismissed saying that
UnionType
was not atype
. But sometimes strange things happen (from a developer's perspective).Defining a data class in a declarative style works fine:
But doing the same thing programatically fails:
Results in:
Because
UnionType
is a class,mypy
is technically correct, but isn't the situation ridiculous?D1.a
is aUnionType
and that wasn't a problem before, but withD2
it is.Defining named tuples works fine either way:
Fine, if
UnionType
is not a union type, then what is the way to express a union type?See https://mypy-play.net/?mypy=latest&python=3.12&gist=92e2f18ed8b463b0d7675c50bb73ee99
The text was updated successfully, but these errors were encountered: