Bug Fixes:
- Fixed bug that results in a false positive error when a covariant type variable that is scoped to a method is used in a parameter annotation.
- Fixed bug that leads to internal data structure corruption and subsequent false positive errors in certain cases involving unions of
Unknown
types that include type aliases. - Fixed bug in the
functools.partial
logic that results in incorrect handling of an unpacked TypedDict when used with a**kwargs
parameter. - Fixed bug that results in a false positive
reportUnsupportedDunderAll
warning when using the__all__.extend(x.__all__)
form and the list of entries inx
is empty. - Fixed bug in TypeVar auto-variance calculations for NamedTuples. Since NamedTuple variables are read-only, they should not cause a TypeVar to be invariant.
- Added subtyping support or
IntEnum
andStrEnum
members. These literal values are subtypes of the corresponding literalint
orstr
. - Fixed bug that results in a false positive error under certain circumstances when passing an overloaded function as an argument to a call.
- Fixed bug that caused first argument of
cast
method onmemoryview
object to be treated as a type expression. Pyright was confusing this method withtyping.cast
. - Fixed a bug that results in incorrect overload matching when one overload contains a zero-arity variant and another overload contains an
*args
(variadic) parameter. - Fixed a bug that results in incorrect type narrowing for truthy/falsy type guards consisting of an Enum member when the enum class derives from ReprEnum. In this case, the "magic" of the enum implementation forwards the
__bool__
call to the underlying value. - Fixed a bug that results in incorrect type narrowing when using
isinstance
with an instance of a generic class as the first argument and a concrete subclass as the filter type. - Fixed bug in type narrowing logic for value patterns, specifically when two enums with members of the same name are involved.
- Fixed bug that causes infinite recursion and memory exhaustion under certain circumstances involving recursive type aliases where the type alias is used as a type argument.
Enhancements:
- Updated typeshed stubs to the latest version.
- Added support for
bool
expansion toLiteral[True] | Literal[False]
during pattern matching when using value patterns.
Behavior Changes:
- Changed
disableLanguageServices
feature to apply to hover text as well as other language services. Previously, hover text was excluded. - Allow
Final
andClassVar
to be combined in both directions within a dataclass. Previously, theFinal
qualifier needed to be the outermost.