Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 44 of 81

1.1.138

Bug Fix: Fixed bug in handling special-case types in typing.pyi or typing_extensions.pyi. The RHS of the assignment was not being evaluated, so symbols referenced in the RHS were not be marked as accessed.

Bug Fix: Changed special-case handling of "overload" definition in typying.pyi stub. New versions of this stub have changed the definition from an object to a function.

Bug Fix: Fixed recent regression in handling of f-strings that are also raw.

1.1.137

Bug Fix: Fixed bug in type inference of dictionary, list and set expressions when they contain classes or class instances that are apparently the same type but internally appear different because they are "pseudo-generic". Pseudo-generic classes are those that have no type annotations in the `__init__` method and are treated internally as generics to improve type inference.

Bug Fix: Fixed bug that caused false positive error when assigning `Type[Any]` to `type`.

Bug Fix: Fixed false positive error when assignment expression (i.e. walrus operator) is used within a class scope.

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: When in "outputjson" mode, the CLI now output log information to stderr.

Enhancement: Add match and case keywords to completion provider.

Bug Fix: Fixed regression that caused runtime assertion (and crash) in some rare circumstances.

Performance: Eliminated O(n*m) behavior when testing type compatibility of a union with n subtypes and a union of m subtypes when those subtypes contain mostly literals.

Performance: Moved checks for string literal errors (unsupported escape characters, etc.) from binder to checker for performance reasons.

Performance: Improved performance of string token value unescape logic by handling the common cases (no format string and no escape characters) using a fast path.

Bug Fix (from Pylance): Fixed bug in file watching logic for config files.

Performance (from Pylance): Reduced work done during parsing and binding related to doc string handling.

Enhancement (from Pylance): Improved document symbol provider symbol type information.

Behavior Change: Removed PEP 563 (deferred type annotation) behavior as default for Python 3.10, since the PEP was deferred.

Bug Fix: Fixed bug in completion provider that caused completions to be provided when pressing "." within the string literal portion of an f-string.

Performance (from Pylance): Provided special-case code paths in parser and binder to speed up symbol indexing operations.

1.1.136

Bug Fix: Fixed bug in diagnostic check for contravariant type variables used in a return type annotation that resulted in a false negative.

Enhancement: Added minimal support for `*` and `**` parameter annotations within function annotation comments.

Behavior Change: Modified algorithm for invariant union type assignments to avoid n^2 behavior.

Bug Fix: Fixed a false positive error that occurs when a class uses itself as a type argument for one of its base classes and that base class uses a bound type variable.

Enhancement: Added logic to skip the normal `__new__` constructor evaluation if the class is created by a metaclass with a custom `__call__` method.

Bug Fix: Fixed bug in TypedDict type narrowing (for containment of non-required fields) that resulted in a false positive error when a narrowed type was later used.

Bug Fix: Fixed bug in type variable constraint solver that resulted in a confusing false positive error in circumstances involving contravariant type variables (e.g. when dealing with callback protocols) and a combination of `Type[T]` and `T` within the callback signature.

Enhancement (from pylance): Improved formatting of doc strings in tool tips.

1.1.135

Behavior Change: Changed behavior of function overload evaluation to more closely match the behavior of other type checkers. Notably, if one or more argument have union types, they are expanded, and each combination of argument union subtypes can use different overloads.

Bug Fix: Fixed bug that caused false positive error when assigning a function with no position-only marker to a function with a position-only marker.

Enhancement: Added support for call arguments whose types are constrained type variables and must be constrained to a particular subtype during call evaluation because the LHS of the call imposes such constraints.

Enhancement: Added support for special cases of class pattern matching as described in PEP 634.

Enhancement: Added support for auto generation of `__match_args__` class variable for dataclass and named tuples.

Enhancement: Added support for type narrowing of the subject expression within a "match" statement based on the matched pattern.

Bug Fix: Fixed bug in type analyzer that resulted in a false positive error when a return type annotation included a generic class but omitted the type arguments.

1.1.134

Enhancement: Implemented first cut at generalized support for dataclass transforms.

Behavior Change: Allow NoReturn return type annotation for `__init__` method.

Bug Fix: Fixed bug in completion provider that resulted in no valid completion suggestions at the end of a "from x import a, " statement.

Bug Fix: Fixed bug in type checker that led to a false positive when assigning a function to a callable type and the source contained unannotated parameters.

Bug Fix: Fixed numerous bugs that result in occasional type evaluation errors, some of which appear to be somewhat non-deterministic.

Bug Fix: Fixed bug in type evaluator that caused incorrect type evaluation for annotated parameter types in some cases.

Bug Fix: Fixed a bug in the type checker that resulted in a false positive error when using "|" (union) operator in parameter type annotations in some cases.

Bug Fix: Changed binder logic for "from .a import x" statements in `__init__.py. Implicit import of ".a" is performed only in cases where there is a single dot. For example, "from .a.b import x" does not implicitly import ".a.b".

1.1.133

Bug Fix: Fixed bug that resulted in a false positive error within type checker when a constrained TypeVar was used in a lambda callback.

Bug Fix: Fixed bug in type variable constraint solver that resulted in false positive error in certain cases involving bidirectional type inference with unknown (or missing) type arguments.

Enhancement: Reduced memory consumption of tokenizer for string literal tokens.

Enhancement: Improved performance of type analyzer in cases where certain type checking diagnostic rules are disabled.

Enhancement: Improved startup time of pyright by eliminating redundant calls to Python interpreter to retrieve import resolution paths.

Behavior Change: Automatically mark parameters as accessed (so they don't appear as "grayed out") in the following circumstances: 1) it is a self parameter in an instance method, 2) it is a cls parameter in a class method, 3) it is a parameter in a method marked abstract, 4) it is a parameter in a method that is part of a protocol class, 5) it is a parameter in an overload signature.

Bug Fix: Fixed incompatibility with pypy when retrieving import resolution paths from the configured Python interpreter.

Enhancement: Added diagnostic for `__init__` method that does not have a return type of `None`.

Enhancement: Configuration settings can now be stored in a pyproject.toml file. If both pyproject.toml and pyrightconfig.json are both present, the latter takes precedent.

Page 44 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.