Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 36 of 81

1.1.186

Enhancement: Added checks for incorrect runtime usage of a UnionType object.

Enhancement: Added more complete type checks involving the use of a default argument for a generic parameter in a constructor.

Bug Fix: Fixed a bug that resulted in a false positive error when accessing members from a `type` instance or a `Type[T]`.

Bug Fix: Fixed false positive error related to heuristics employed in bidirectional type inference for calls when the expected type comprises a union and the return type of the call is a union that includes Any and a type variable.

Enhancement: Added support for `slots` parameter to dataclass, a new feature added in Python 3.10.

Bug Fix: Fixed regression that caused a false positive error related to incorrect usage of a type variable within a type alias definition.

Bug Fix: Fixed incorrect handling of client-initiated progress reporting for "onReferences" and "onExecuteCommand" handlers in language server.

1.1.185

Bug Fix: Fixed bug in completion provider where it was not properly handling binding to classes, which left parameter types unspecialized in some cases. It was already properly handling binding to objects (class instances), so this was a straightforward extension.

Enhancement: Added support in completion provide for enum members. They are now properly identified as such and prioritized higher in the completion list than other non-member symbols.

Enhancement: Improved readability of diagnostic message for type mismatch when assigning to a tuple expression.

Bug Fix: Fixed a bug in the handling of `reveal_type` that caused hover text within the argument to be displayed as `Unknown` in some circumstances.

Enhancement: Added special-case support for the `__self__` attribute of a bound method.

Bug Fix: Fixed bug that resulted in stack overflow.

Bug Fix: Fixed bug in stub generation code that resulted in an error if a stub was requested for a submodule in a package that includes an `__init__.py` file in the same directory as the submodule source file.

Enhancement: Improved signature help for the constructor of classes that define a `__new__` method but no `__init__` method, such as the `zip` class. The previous logic was always preferring the `__init__`, which is supplied by the `object` class, which all classes derive from.

Bug Fix: Fixed a bug that resulted in a false positive error when assigning one ParamSpec to another ParamSpec.

Bug Fix: Fixed bug that resulted in false positive "reportUnknownMemberType" error when using a generic class within a class pattern.

Bug Fix: Added missing diagnostic check for illegal type argument lists that include a ParamSpec when the type parameter list includes a ParamSpec.

Enhancement: Added missing keyword "with" from completion provider.

Bug Fix: Fixed bug in type promotion logic that resulted in false positive. It wasn't properly handling subclasses of promotable types (like 'int', which can be promoted to 'float').

Enhancement: Improved bidirectional type inference for call expressions. The logic now handles the case where the return type of the callable is a generic type that is not an exact match for the expected type but is assignable to the expected type.

Enhancement: Added support for explicit type aliases (PEP 613) within class scopes. A proposed amendment to PEP 613 will make this legal.

Enhancement: Added check for a class-scoped generic type alias that uses a class-scoped TypeVar. This is now flagged as an error.

1.1.184

Bug Fix: Fixed false positive error when a class used within as a TypeVar `bound` argument is a "pseudo generic" class, one whose constructor is unannotated.

Bug Fix: Changed type evaluator to elide `NoReturn` from union generated from `or` or `and` operator.

Enhancement: Improved error handling for the `Generic` special form. Eliminated false positive error when `Generic` is used in certain legitimate ways within a function.

Enhancement: Improved error messages for call expressions that involve overloaded functions.

Enhancement: Implemented optimization that reduces analysis time and memory usage by generating a diagnostic message (which often involve converting types to a textual representation) only if the caller is interested in the diagnostic message.

Enhancement: Added support for "Self" type documented in draft PEP: https://docs.google.com/document/d/1ujuSMXDmSIOJpiZyV7mvBEC8P-y55AgSzXcvhrZciuI/edit.

Enhancement: Added support for trace logging of type evaluation from the command line when both `--stats` and `--verbose` are specified.

Bug Fix: Fixed bug that resulted in the incorrect type evaluation when a property was defined on a metaclass and accessed through a class with that metaclass.

1.1.183

Bug Fix: Fixed bug in handling of the recently-added "--skipunannotated" command-line flag.

Bug Fix: Fixed a recent regression that resulted in a false positive error when `Union` was used with no type arguments outside of a type annotation.

Enhancement: Extended support for bidirectional type inference for functions that have a generic return type and the "expected type" is a generic class with type arguments that include literal types.

Enhancement: Expanded support for bidirectional type checking for function call expressions where the return type of the function includes a TypeVar that also appears within a function parameter and that parameter is a callable.

Bug Fix: Fixed bug that resulted in incorrect type evaluation for a generic function that returns a specialized class that uses a `Concatenate` in one of the type arguments.

Bug Fix: Fixed bug that caused the type of `super().__new__(cls)` to be evaluated incorrectly.

Bug Fix: Changed type evaluator to elide `NoReturn` from union generated from ternary operator.

Bug Fix: Fixed a bug that allowed a function to be assigned to a (non-protocol) class if that class defined a `__call__` method. This should be allowed only for protocol classes.

Bug Fix: Fixed a bug that allowed a function to be assigned to a protocol class if it defined a `__call__` method but also defined additional methods or attributes.

Behavior Change: Changed text representation of inferred type of `self` and `cls` parameters to `SelfClassName`. This is more consistent with the emerging standard for an explicit `Self` type.

1.1.182

Enhancement: Implemented missing check for a write to a Final instance or class variable outside of the class implementation.

Enhancement: Added missing check for an attempt to write to a named tuple attribute, which generates a runtime exception.

Bug Fix: Fixed bug that resulted in a false positive when a function returned a callable type that included a parameter with a union type that included an unsolved type variable.

Bug Fix: Improved handling of intersection types produced as part of `isinstance` or `issubclass` type narrowing when the source variable is a type variable. The creation of the intersection type was incorrectly eliminating the association with the type variable, so the narrowed type was no longer seen as compatible with the TypeVar.

Enhancement: Added check for `Union` when only one type argument is provided and it is not an unpacked variadic type variable.

Bug Fix: Fixed bug in "--ignoreexternal" option used with package type verification. It was not correctly ignoring all externally-imported symbols that had unknown or partially-unknown types.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed false positive error when a constrained TypeVar T and Type[T] were both used in the same function signature.

1.1.181

Enhancement (from pylance): Improved completion suggestions when typing within a list expression.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug in type printing logic where it incorrectly displayed captured ParamSpec signature with "/" or "*" parameters.

Bug Fix: Fixed bug that caused false positive error when assigning one callback protocol to another when both protocols are generic and parameterized with a ParamSpec.

Bug Fix (from pylance): Fixed regression with "--watch" option in command-line version of pyright.

Behavior Change (from pylance): Increase max file size to 50 MB, matching VS Code.

Enhancement: Improved logic for isinstance and issubclass type narrowing when the filter class's type arguments can be determined from the type arguments of the subject type.

Enhancement: Improved type narrowing logic for class pattern matching when the matched class's type arguments can be determined from the type arguments of the subject type.

Bug Fix: Fixed bug that resulted in an incorrect type evaluation for a binary operator that acts upon a bound TypeVar.

Performance: Reduced the max number of nested call-site return type inference evaluations from 3 to 2. This can be extremely expensive in some code bases, such as with scipy, and it was leading to a poor user experience.

Performance: Improved analyzer performance for code that contains thousands of statements with tens of thousands of call statements within a single function or module. This is found in some test modules within the sympy library.

Enhancement: Added "--skipunannotated" option for command-line version of pyright. If specified, pyright skips type analysis of functions and methods that have no parameter or return type annotations. Return types of functions are also never inferred from the function implementation. This matches the default behavior of mypy and allows for more efficient analysis of complex code bases that are only partially annotated.

Page 36 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.