Pyright

Latest version: v1.1.390

Safety actively analyzes 688087 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 21 of 81

1.1.274

Bug Fix: Fixed a bug that resulted in incorrect type evaluation for members of a `StrEnum` subclass under certain circumstances. This was caused by a circular dependency in `ReprEnum` caused by pyright's validation of `__init_subclass__` as part of class type evaluation. This change moves this validation step from the type evaluator to the checker, eliminating the potential for circular dependencies and improving performance.

Bug Fix: Fixed a bug that resulted in a false positive error indicating that a type definition relies on itself in a circular manner.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation for constructor calls using bidirectional type inference where the expected type includes TypeVars that are not in scope for the constructor call.

Bug Fix: Fixed a bug that resulted in incorrect type narrowing based on literal field discrimination (`<a>.field == <literal>`) where the expression `<a>` is a member access expression.

Bug Fix: Fixed a bug in the "--verifytypes" CLI option that resulted in incorrect calculation of the type completeness core in cases where a private symbol with an incomplete type was imported and re-exported from a public module.

Bug Fix: Fixed a bug that resulted in incorrect analysis when a `ClassVar` annotation was enclosed in quotes (i.e. a forward reference).

Bug Fix: Fixed a bug that resulted in a false positive error when a contravariant generic class was specialized with a union type argument used with bidirectional type inference.

Enhancement: Updated typeshed stubs to the latest.

1.1.273

Bug Fix: Fixed recent regression that resulted in a false positive error related to argument-to-parameter matching.

Enhancement: Added a missing check for class-scoped covariant or contravariant TypeVars that are used in a base class where the base class defines the corresponding type parameter to be invariant. This leads to a typing hole, so it should be considered an error.

Bug Fix: Fixed a bug that led to the incorrect inferred type for a parameter in an unannotated `__init__` method in the case where the method overrides a method in a base class.

1.1.272

Enhancement: Added bidirectional type inference support for comprehension statements that create generators. This addresses https://github.com/microsoft/pyright/issues/3948.

Bug Fix: Improved handling of circular dependencies in a generic class hierarchy — in particular, where a class is parameterized by a constrained TypeVar where one of the constraints includes the class or its ancestors. This addresses https://github.com/microsoft/pyright/issues/3955.

Bug Fix: Fixed false positive `reportInvalidTypeVarUse` diagnostic in an overload implementation. This addresses https://github.com/microsoft/pyright/issues/3958.

Bug Fix: Fixed confusing error message when a value is written to a class attribute that is not defined on the class but is defined on the metaclass but with an incompatible type. This addresses https://github.com/microsoft/pyright/issues/3960.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Improved error message readability for generic class type incompatibilities.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when calling a generic class constructor from within that class implementation. This addresses https://github.com/microsoft/pyright/issues/3927.

Bug Fix: Fixed recent regression. Default includes/excludes should be used when pyproject.toml is present. This addresses 3965.

Enhancement: Extended support for method override completions that use member access expression forms in a parameter's default value expression. This addresses https://github.com/microsoft/pylance-release/issues/3374.

Bug Fix: Fixed false positive error when a call expression provides zero arguments for an unpacked tuple of indeterminate length within a Callable. This addresses 3972.

Bug Fix: Improved error message for positional parameter count mismatch when the signature contains an unpacked tuple with either a definite or indefinite length.

1.1.271

Bug Fix: Fixed a bug in `assertNever` internal function that resulted in a crash when attempting to stringify a recursive data structure. This shows up occasionally in the crash telemetry.

Bug Fix: Fixed an infinite recursion bug in the type printer that shows up occasionally in the crash telemetry.

Bug Fix: Fixed a bug that resulted in infinite recursion when a `global` statement is used within the global scope of a module.

Enhancement: Added new check for an attempt to instantiate `Dict`, `Set`, `List`, or `Tuple` from `typing` module. This generates a runtime exception.

Bug Fix: Fixed recent regression that resulted in a false positive error when defining a variable in a class body and using its own field name as a type annotation.

Bug Fix: Fixed bug that results in incorrect narrowing for sequence patterns in a match statement in the negative (fall-through) case when the subject type is a tuple of known length but with elements of type `Any`.

Enhancement: Added support for quoted `TypeAlias` type annotation.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when narrowing types for class patterns in a match statement when the matched class is a generic subclass of the subject type.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when an `isinstance` type guard results in an intersection type and one of the sources of the intersection is a conditional type.

Bug Fix: Fixed a bug that resulted in a transient false positive error in certain cases where a member access expression was used within a quoted type annotation.

1.1.270

Enhancement: Improved precision of error handling for tuple, list and set expressions.

Bug Fix: Fixed a bug that resulted in incorrect type narrowing for literal patterns in a match statement when the target expression type includes an instance of a class that derives from the literal's class (e.g. a subclass of `str`).

Bug Fix: Fixed a bug that led to the incorrect inferred return type for a `super().__new__(cls)` call.

Bug Fix: Added support for TypeVarTuple to capture an unpacked tuple with unbounded length.

Bug Fix: Fixed a bug that resulted in unpacked arguments to a class definition going unevaluated, which means that any symbols they referenced were not marked accessed.

Enhancement: Expanded `reportUnusedExpression` check to detect unused tuple, dictionary, list and set expressions if they don't contain comprehensions.

Bug Fix: Fixed a bug that resulted in a false positive when passing a generic function to an overloaded function that requires union expansion to resolve.

Bug Fix: Fixed type evaluation bug that led to a false positive error when assigning a type conditioned on a bound TypeVar to that same TypeVar in an invariant context.

Bug Fix (contribution by timsu92): Fixed incorrect description of reportUndefinedVariable.

Bug Fix: Fixed bug in type evaluator that caused a false negative in some circumstances when constructing an instance of a generic class within that class implementation.

Bug Fix: Fixed a bug that resulted in a false negative when an annotated variable was assigned an expression that included the variable's name and the variable was undefined prior to the assignment.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug in the type checker that led it to conclude that two types were the same even though they were declared in separate modules. This occurred when the types had the same (local) name and both modules were located within project directories that contained characters that are invalid for module paths in an import statement (e.g. "-").

Enhancement: Updated PEP 695 functionality to reflect the latest changes in the spec.

1.1.269

Bug Fix: Fixed a bug that resulted in the `reportImportCycles` check to sometimes fail to detect and report some import cycles.

Bug Fix: Fixed bug that resulted in a false positive error when specifying a metaclass that contains an `__init__` method with unannotated parameters.

Bug Fix: Fixed a bug that led to a false negative when assigning a concrete type to an instance variable with a generic (class-scoped) type.

Enhancement: Enhanced the `type(x) is y` type guard logic to support the case where `x` is typed with a TypeVar bound to a class.

Bug Fix: Fixed a bug that resulted in a false positive error when determining type compatibility of a generic type with an invariant type parameter and a type argument that is a union which includes an instance of a class and an instance of a subclass.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when solving for a contravariant type variable when a union of callables is passed as an argument.

Page 21 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.