github microsoft/pyright 1.1.96
Published 1.1.96

latest releases: 1.1.363, 1.1.362, 1.1.361...
3 years ago

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: Switched to LSP-native progress reporting rather than using custom progress reporting messages.

New Feature: Added a new diagnostic rule called "reportInvalidTypeVarUse" that flags errors when TypeVars are used incorrectly. In particular, it flags the use of a single instance of a TypeVar within a generic function signature.

Bug Fix: Fixed assertion (and associated crash) that results when an LS client asks the language server to open a non-Python file (i.e. one whose file name doesn't have a ".py" or ".pyi" extension). The server now ignores such requests rather than crashing.

Enhancement: Enhanced ParamSpec mechanism to support parameters that have default values.

Bug Fix: Fixed issue with variable expansion for environment variables used within settings.

Enhancement: Improved error message for yield type mismatch.

Performance Improvement: Added a heuristic to skip call-site return type inference if the number of arguments is above a threshold (6). This avoids long analysis times for complex unannotated functions.

Bug Fix: Fixed bug in error message for tuple size mismatches in the case where the source tuple has indeterminate length and the dest has a specified length.

Bug Fix: Fixed incorrect assertion (which manifests as a runtime crash) when assigning to a type that is a generic class with no specified type arguments.

Enhancement: Added new error for a protocol class that derives from a non-protocol base class.

Behavior Change: Changed the logic for Type vs type such that Type (the capitalized form) is always used in cases where there is a type argument (such as Type[int] or type[str]andtypeis used in cases where the non-generic classtypeis intended. This allowstypeto be used inisinstance` type narrowing.

Bug Fix: Fixed bug in function assignment logic in the case where the destination function has name-only parameters and the source has positional parameters that match those name-only parameters.

Behavior Change: Changed heuristic for when a decorator should be ignored for purposes of type checking. It was previously ignored if the application of the decorator resulted in an "Unknown" type. The new heuristic also ignores the application of the decorator if the resulting type is a union that includes an Unknown subtype. This situation occurs frequently with unannotated decorators where part of the result can be inferred but part cannot.

Bug Fix: Fixed bug that caused incorrect type evaluation when a relative import referenced a submodule with the same name as a symbol that was imported from that submodule if that submodule was later imported again within the same file (e.g. from .foo import foo, from .foo import bar).

Enhancement: Added support for protocol callable types when performing bidirectional type inference for lambda expressions.

Enhancement: Improved "isinstance" narrowing to better handle the case where the narrowed expression is a constrained TypeVar. It now preserves the constraint so the value can be assigned back to the TypeVar type.

Bug Fix: Fixed bug in "is None" and "is not None" type narrowing logic when dealing with recursive type aliases.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.