Bug Fixes:
- Fixed a bug that results in a false positive error in the
reportUnknownMemberType
check whenabc.Callable
(without any type arguments) is used in the second argument to anisinstance
call. - Fixed bug in literal pattern matching that resulted in incorrect narrowing when the subject was typed with a constrained TypeVar.
- Fixed bug that led to incorrect conversion from a class constructor to a function when it involves a
__new__
method that returnsSelf
. - Fixed bug that resulted in crash under certain obscure circumstances where a class with multiple type parameters is explicitly specialized with only a subset of required type arguments.
- Eliminated some differences between the treatment of
type
andType
. These should be treated the same under all circumstances. - Fixed recent regression that resulted in a false positive when accessing a class property from a class instance.
- Fixed a bug that can result in spurious false positive errors when using deeply-nested or recursive type definitions such as
_NestedSequence
in numpy. - Fixed bug that led to a false negative when
Never
is used as an explicit type argument for a generic class or type alias if the corresponding type parameter is a constrained TypeVar. - Fixed bug that produces a false negative when attempting to assign a method to a
Callable
type where the first parameter of the method is typed asSelf
, but the callback requires the class itself. - (from Pylance) Fixed bug that led to false positive errors related to import resolution when a partial stub is used and its directory structure doesn't match that of the library.
Enhancements:
- Improved error handling for failures when explicitly specializing a generic type alias. Improved diagnostic message for
assert_type
failures when printed types look the same when not using the full name of the type. - Added support for bidirectional type inference for chained assignment expressions.
- Updated typeshed stubs to the latest version.
- Added deprecation message for class properties, which were deprecated in Python 3.11 and are going away in Python 3.13.
- Added support for parameter type inference for lambdas whose parameters include default arguments. This is analogous to the logic used for unannotated function parameters with default arguments.
Behavior Changes:
- Changed the behavior for empty dict or list expressions. Previously, a variable initialized with
{}
or[]
was not flagged as "partially unknown" by thereportUnknownArgument
check when used as an argument to a call. This resulted in a small type hole. - Changed type evaluation logic for member access expressions for
type[Any]
where the target attribute is not explicitly declared in thetype
orobject
class. Previously, pyright emitted an error in this case.