Skip to content

Published 1.1.315

Compare
Choose a tag to compare
@github-actions github-actions released this 21 Jun 01:48
· 1108 commits to main since this release

Bug Fix: Fixed a regression that caused a false positive reportMissingTypeArgument diagnostic when using a generic type in conjunction with the | union operator in the second argument to an isinstance or issubclass call.

Bug Fix: Modified protocol matching and the constraint solver to handle an edge case where a partially-solved type variable with a solution of Any are provided by other argument types in a call.

Bug Fix: Fixed a bug that leads to a false positive error in the reportIncompatibleMethodOverride check when a child class is overriding an overloaded method in the base class and one or more of the overloads doesn't apply because the self or cls parameter is explicitly annotated in a way that's not applicable to the child class.

Bug Fix: Fixed a bug in type evaluation of the two-argument form of the super call. There were situations where the incorrect MRO class was used.

Bug Fix: Fixed bug that led to false positive errors when performing protocol matching in certain circumstances.

Bug Fix: Fixed a bug that led to a false positive when passing unpacked lists or dictionaries to a constructor for a class that doesn't provide its own constructor and falls back to the object constructor.

Bug Fix: Changed parameter type inference logic to avoid inferring the type of an unannotated parameter with a default value consisting of a lambda.

Bug Fix: Fixed a regression that caused an incorrect type evaluation of a function that returns a callable with a ParamSpec that does not appear outside of the return type annotation. A previous fix didn't correctly handle the case that involved a class parameterized with a ParamSpec.

Bug Fix: Fixed a false negative where an unpacked dictionary argument was not validated against the **kwargs parameter type.

Bug Fix: Fixed several subtle bugs in the overload matching algorithm in the case where Any or Unknown arguments are present.

Enhancement: Improved the heuristic used to determine which subtypes of a union within an "expected type" should be used for bidirectional type inference.

Bug Fix: Fixed bug that led to an incorrect type evaluation for nested call expressions where an inner call expression used a ParamSpec.

Bug Fix: Fixed false negative when a literal and non-literal are assigned to the same TypeVar in an invariant context.

Behavior Change: Changed auto-variance algorithm to ignore __new__ and __init__ methods for purposes of calculating the variance of a TypeVar. This mirrors the behavior of mypy.

Bug Fix: Fixed a bug that led to incorrect type evaluation when passing a generic class (with a constructor that includes class-scoped TypeVars) as an argument for a callable parameter. The class was being specialized prematurely (with type arguments set to Unknown) before the constraint solver was able to solve the higher-order function's type variables.

Bug Fix: Fixed a false positive error arising from the use of a binary expression for a base class in a class declaration statement.

Enhancement: Improved hover text to display the calculated variance for a PEP 695-style class-scoped type variable when the user hovers over the type parameter in the type param list.

Bug Fix: Fixed a bug that led to a false positive error under certain circumstances when a literal type argument was used in conjunction with a protocol that used a covariant type parameter and an implementation of that protocol that used an invariant type parameter.

Behavior Change: Changed type printer (the component that renders types into text) to use the lowercase type[x] instead of Type[x]. It has now been four years since PEP 585 deprecated the use of the upper-case version, so most developers should be getting comfortable with the lowercase version at this point.

Enhancement: Improved reportUnnecessaryCast so it works with types other than class instances.

Enhancement: Improved type inference for lambdas in the case where a parameter includes a default value and the expected type doesn't include that parameter.

Bug Fix: Fixed bug in code flow engine that led to incorrect type evaluation of a variable in a nested loop.

Bug Fix: Fixed bug that resulted in a false positive error when defining a new type alias using the TypeAliasType constructor that defines no new type parameters but references an outer-scoped type parameter in the type alias definition.

Enhancement: Enhanced command-line version of pyright to allow file or directory names to be passed via stdin if - option is used in the command line.

Behavior Change: Changed behavior of non-ClassVar variables within a protocol definition. Previously, an error was reported when such variables were accessed from the class (as opposed to an instance of the class). Mypy (which was the reference implementation for PEP 544) does not report an error here.

Bug Fix: Fixed a bug that caused incorrect type inference for parameters in unannotated methods within child classes who derive from a generic parent class.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that caused an incorrect false positive error for an assert_type call involving a Callable[[], X] type. Pyright was generating a signature with a positional-only separator in this case.

Enhancement (contributed by debonte): Added support for PEP 712's new attribute assignment conversion.

Performance: Fixed a bug in type caching mechanism that could have resulted in poor performance in certain circumstances.

Performance: Added low-level caching mechanism for converting between instance and instantiation types. This should reduce memory usage in some circumstances.

Enhancement: Enhanced the isinstance type narrowing logic so it filters types based on the number of entries in a tuple if the type derives from a tuple.