Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 18 of 81

1.1.292

Bug Fix: Fixed a bug that results in a false positive error in certain circumstances when a `match` statement is used within a loop.

Bug Fix: Fixed a bug that caused a hang when a function that accepted a `Callable` with a `ParamSpec` was fed to itself as an argument.

Enhancement: Improved formatting of function signatures in hover text.

Enhancement: Added heuristic to better handle the case where a symbol is imported from two different modules, one in a `try` block and another in an `except` block. This pattern can be found in a number of libraries.

Enhancement: Added filtering in hover provider for overloaded constructors. Filtering for other overloaded functions and methods was previously added, but constructors were overlooked.

Bug Fix: Fixed a bug that resulted in an infinite loop in some cases where list lists, sets or dicts were inferred loop construct.

Enhancement: Extended the `reportUnnecessaryComparison` check to also handle conditions of the form `x is None` and `x is not None`.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that resulted in incorrect type narrowing for discriminated TypedDict types when the narrowed expression includes a member access subexpression.

Bug Fix: Fixed bug in command-line version of pyright that led to the inclusion of file names in the output diagnostic report in cases where diagnostics were completely suppressed for that file using the `--level` option.

Enhancement: Improved type narrowing for truthy tests that involve `int`, `str` or `bytes` values. In the negative case, we can assume that the type is `Literal[0]`, `Literal['']` or `Literal[b'']`.

Bug Fix: Fixed bug that resulted in a false positive when trying to assign a value of type `NoneType` to `type[object]`.

Bug Fix: Fixed a bug that led to a false negative when a backslash character was used within an expression segment of an f-string.

Behavior Change: Modified overload matching algorithm to more closely match that of mypy. In the case where one or more arguments evaluate to Any but those arguments map to parameters whose types are the same, the first overload is selected. Only in cases where an Any argument produces ambiguous results is an Unknown result produced.

Bug Fix: Fixed a bug in the handling of file specs (globs) used for the "include" configuration option. A directory wildcard pattern (**) was not handled correctly.

Behavior Change: Disabled type narrowing for expressions of the form "<literal> == X" and <literal> != X". These were never documented to work, and they were causing significant performance issues. Also reverted recent attempt to modify the code complexity algorithm, as this change is no longer necessary.

Performance: Addressed performance issue in code that includes loops and many interdependencies between variables with inferred types. The optimization involves the introduction of an incomplete type generation count that is updated when a the type cache is updated in a way that could affect previously-calculated incomplete types.

Bug Fix: Fixed a bug that led to a false positive error about an "unknown type" in certain cases when using an assignment expression (walrus operator) in a loop.

1.1.291

Bug Fix (from Pylance): Allow non-identifier characters immediately after region.

Bug Fix: Fixed a bug that led to a crash in certain circumstances where a TypedDict field annotation contained a circular reference to the TypedDict.

Bug Fix: Fixed a bug that led to a crash under certain circumstances when a dictionary expansion subexpression (`**val`) was used.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation for a symbols within a py.typed module that is contained with a non-py.typed namespace package.

Bug Fix: Fixed inconsistency within `isinstance` type guard logic when handling the narrowing of a type that contains a union with `Any` or `Unknown`.

Bug Fix: Fixed a bug that resulted in a false positive error when generic class with an invariant type parameter is used in specialized form as a type argument for a class with a contravariant type parameter.

Performance: Improved type analysis performance in some cases that involve protocol matching where the protocol incorporates an overloaded method.

Bug Fix (contribution by André Fontenele): Fixed a bug that caused "go to definition" to go to a bogus position within a file in cases where the identifier refers to a module.

Performance: Added optimization to handle unions that contain large numbers of union literals.

1.1.290

Bug Fix: Fixed regression that resulted in an incorrect `Unknown` type when evaluating a list comprehension in a loop.

Bug Fix: Fixed bug that resulted in incorrect contextual evaluation of certain sub-expressions.

Bug Fix: Improved bidirectional type inference logic to handle cases where an expected type includes a TypeVar that is bound to a type that influences the type inference.

Bug Fix: Fixed a recent regression with the truthy/falsy type guard logic when a constrained TypeVar is involved.

Enhancement: Improved error message for implied return type mismatch.

Bug Fix: Fixed bug that resulted in a false positive error when using the `|` operator for two sets of str values within a `join` call.

Bug Fix: Moved `__init_subclass__` argument validation from the checker to the type evaluator so types of keyword arguments used in the class declaration are evaluated consistently. Prior to this, hovering over a keyword argument sometimes displayed an `Unknown` type.

Bug Fix: Fixed a bug that resulted in a false negative when binding an object to an overloaded method where all of the overloads have an annotated `self` type and none of them match the type of the object.

Bug Fix: Fixed a bug that led to infinite recursion in certain circumstances when using a recursive type alias with a type variable.

Bug Fix: Fixed a bug in the type printer that generated incorrect output for bytes literal types that include non-printable characters.

Bug Fix: Fixed a bug that resulted in false positive errors when an f-string uses an escape character sequence within the format string section.

Enhancement: Extended user-defined TypeGuard functions to support objects with `__call__` method.

1.1.289

Bug Fix: Fixed a bug that resulted in incorrect type evaluation for a callable attribute within a TypedDict or dataclass. If the attribute has no type annotation, it should be treated as a class variable, not an instance variable.

Bug Fix: Fixed a bug that causes incorrect interpretation of a large integer literal value — one that doesn't fit within a 53-bit mantissa.

Bug Fix: Fixed a bug in the truthy/falsy type guard logic when using `self` (or another bound TypeVar) where the bound class implements a `__bool__` method.

Bug Fix (from pylance): Fixed a bug in vscode-languageserver client that caused bogus cancellation assertion.

Bug Fix: Fixed bug in `dataclass_transform` logic for `frozen_default`. If the `frozen_default` is set to `True`, it wasn't possible to override it with `False` explicitly.

Bug Fix: Fixed bug that resulted in a false positive error when using the `|` operator to combine two `set` objects.

Bug Fix: Fixed a bug that resulted in an infinite loop when tuple addition was used within a loop construct.

Bug Fix: Fixed bug that led to a false positive when using method-scoped type variables in a type annotation for a `cls` parameter in a classmethod.

Enhancement: Added a new check for a TypeGuard or StrictTypeGuard function that does not have at least one input parameter.

Bug Fix: Fixed a bug that resulted in a false negative when bidirectional type inference was used for a list expression and a list entry with an incompatible type is present.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support for `x[K] is V` and `x[K] is not V` type narrowing forms.

Enhancement: Added support for the tentatively-accepted PEP 649 (deferred evaluation of annotations) in Python 3.12.

Bug Fix: Fixed a bug that resulted in a crash within the document symbol provider when a "naked" decorator is present.

Enhancement: Added provisional support for draft PEP 702 (marking deprecations using the type system).

1.1.288

Bug Fix: Fixed a bug that resulted in a false positive error when accessing `__required_keys__` and `__optional_keys__` class variables from a TypedDict class.

Enhancement: Added support for type guard forms `x is ...`, `x is not ...`, `x == ...` and `x != ...`. Support for these were recently added to mypy.

Enhancement: Added support for `NoneType` to be used in an `isinstance` type guard or match statement.

Bug Fix: Fixed a bug that resulted in a false positive when using heavily-nested call expressions that target overloads. The speculative type cache was not storing information about whether the type evaluation resulted in errors, so incorrect overloads were being chosen in the cached path.

Bug Fix: Fixed a recent regression that led to a false positive in certain cases when a call to a generic function was made within a loop.

Bug Fix: Fixed a bug that resulted in a false positive error in certain cases when using PEP 695 type parameter syntax.

Bug Fix: Fixed a bug that resulted in an incorrect type evaluation when calling a constructor on a class that uses new PEP 696 TypeVar defaults and provides an `__init__` but no `__new__`.

Bug Fix: Fixed a bug that led to a false negative when comparing a function without a `*args` to a callable type with a `*args`.

Bug Fix: Fixed a bug in PEP 696 (TypeVar defaults) logic that resulted in a false positive error when a `Self` type was used within a generic method that also used a TypeVar with a default type.

Bug Fix: Fixed a bug that resulted in incorrect `isinstance` type narrowing in certain cases when found within a loop construct.

Bug Fix: Fixed a bug that resulted in a false positive error when a generic class used a contravariant type variable and defined a `__new__` method that uses `cls: type[Self]` as a parameter.

1.1.287

Bug Fix: Fixed false positive error in parser when an assignment expression (walrus operator) is used in a subscript list without parentheses. This was a syntax error in Python 3.8 and 3.9 but is allowed in 3.10 and newer.

Bug Fix: Fixed regression that caused an incorrect type evaluation in the presence of a doubly-nested loop.

Bug Fix: Fixed bug that sometimes resulted in incorrect type evaluation of tuple expressions used within a loop.

Bug Fix: Fixed a bug in the import cycle detection logic that led to some false negatives.

Enhancement: Addressed type evaluation performance issue by eliminating separate "incomplete type cache" and combining it with the primary type cache.

Enhancement: Improved error reporting for type mismatch involving a return type that is a TypedDict.

Bug Fix: Fixed a bug that resulted in a false positive error when resolving nested overloaded function calls where the correct overload match depends on bidirectional type inference.

Page 18 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.