Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 19 of 81

1.1.286

Bug Fix: Reverted a recent update to the TOML parser that resulted in a regression. This reversion means that some TOML 1.0 features will not be handled correctly.

Bug Fix: Fixed a bug that resulted in incorrect handling of literals in the TypeVar constraint solver. This involved a pretty significant change to the constraint solver logic — one that eliminated some heuristics and special cases.

Bug Fix: Fixed a bug that caused target expressions within a chained assignment to be evaluated in the wrong order (right to left instead of left to right). This resulted in false positives and negatives in some cases where one target referred to another target. This change also makes it illegal to use a Python 2-style type comment on a line containing a chained assignment statement, reflecting the fact that Python 3-style variable type annotations are not legal here either.

Enhancement: Improved handling of TypeVarTuple constraint solving. Previously, if a TypeVarTuple appeared more than once, the corresponding tuple types needed to be identical. The constraint solver now supports the same sort of narrowing/widening within the tuple entries to find the best solution.

Bug Fix: Fixed a bug that led to a false negative during protocol matching if the protocol class refers to itself within an invariant type argument.

Enhancement: Improved handling of generic functions passed as arguments to generic higher-order functions. Pyright is now able to solve the type variables for both the generic callback and the called function.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Improved handling of generic functions passed as arguments to generic higher-order functions that use a ParamSpec. Pyright is now able to solve the type variables for both the generic callback and the called function.

Bug Fix: Fixed a bug in the code flow engine that resulted in incorrect type evaluation in some cases involving double nested loops.

Bug Fix: Improved the method override consistency checks to detect the case where an override uses an `*args` parameter that is not type compatible with the overridden method's parameter types. Thanks to mehdigmira for this contribution.

Enhancement: Improved handling of TypeVars that appear only within a Callable within a return type annotation for a function. By a strict reading of PEP 484, these should be bound to the function's scope, but practically, they are bound to the Callable. This allows a function to return a generic callable type. When TypeVars are rescoped in this manner, the TypeVar cannot be referenced within the function body because it is no longer in scope in that context.

Enhancement: Improved error handling for `NewType` calls

Enhancement: Completed initial implementation of PEP 696. Added support for default TypeVar types that refer to other TypeVars.

1.1.285

Enhancement: Implemented a new `--level` command-line option that allows filtering of 'information' and 'warning' diagnostics.

Enhancement: Updated TOML parser to one that is compliant with the TOML 1.0 spec.

Enhancement: Added logic to detect uses of PEP 604 `|` syntax that generate exceptions due to runtime limitations. In particular, if one of the operands is a string (i.e. a forward reference) and the other is also a string or a class that is not explicitly specialized, this will result in an exception.

Bug Fix: Fixed recent regression in completion provider that resulted in garbled type information for a symbol that is declared as a function (using a `def` statement) but transformed into a non-function type using a decorator.

Bug Fix: Fixed a bug that resulted in a false positive error when an index expression with a numeric literal subscript was used in a loop that included a `del` statement targeting the same index expression.

Behavior Change: Modified the overload matching algorithm to match the behavior of mypy when the overload match is ambiguous because an argument evaluates to `Any` or `Unknown`. In this case, the call expression evaluates to `Unknown`. Previously, pyright used the first of the matching overloads in this case.

Bug Fix: Fixed a bug that led to extremely long type analysis times when determining type compatibility between an recursive type alias and a recursive protocol.

Bug Fix (contribution from parched): Fixed recent regression that caused reportImportCycles diagnostic reporting to no longer work.

Bug Fix: Fixed a bug that resulted in a false positive error when a property setter or deleter contained function-scoped type variables.

1.1.284

Bug Fix: Fixed a bug that resulted in an incorrect type evaluation when using a literal integer index into a tuple that includes an unpacked TypeVarTuple element.

Behavior Change: Removed diagnostic check that detects a non-ellipsis default value in a stub file. This check was based on a now-outdated best practice. We now recommend that stubs include default values for better usability in language servers.

Bug Fix: Fixed recent regression that caused the hover text for a function symbol to be improperly formatted if its type was evaluated to something other than a function.

Enhancement: Exposed new configuration setting `analyzeUnannotatedFunctions` which corresponds to the `--skipunannotated` command-line option. Added an information diagnostic for skipped functions.

Bug Fix: Fixed bug that resulted in an incorrect target range when resolving the declaration of an import. There were cases where "Go To Declaration" would take you to a location within the target file that corresponded to the offset of the import statement within the importing file.

Bug Fix: Fixed bugs that resulted in false positive errors when assigning a `type` to a `Callable` and when accessing members from a `type[T]` or a `T` that is bound to `type`.

Enhancement: Improved bidirectional type inference for list, set and dictionary expressions when the "expected type" is a union that contains multiple potentially-compatible subtypes.

Bug Fix: Fixed a bug that led to a false positive error when evaluating a recursive type alias definition that uses a generic type that is parameterized using a bound or constrained type variable.

Bug Fix: Added missing diagnostic rule in diagnostics reported as part of the `reportImportCycles` check. Thanks for parched for this fix.

Bug Fix: Fixed false positive error in multi-inheritance override check in cases where the override symbol was provided by one of the base classes.

Enhancement: Updated typeshed stubs to the latest version.

Behavior Change: Added check for disallowed expression forms used with `TypeAlias` and with PEP 695 `type` statement.

Bug Fix (from pylance): Fixed exclude/include to work with '.' prefixed directories.

Bug Fix: Fixed a bug that led to a false positive when a `NoReturn` or `Never` type argument was used for a covariant type parameter.

Bug Fix: Fixed regression that resulted in inconsistent behavior when `useLibraryCodeForTypes` is false and a symbol is imported from a non-py.typed library.

1.1.283

Enhancement: Added support for ` pyright: ignore` and ` type: ignore` comments that are not at the start of a comment.

Enhancement: Improved parse recovery for common indent/dedent conditions.

Bug Fix: Fixed recent regression that resulted in a false positive when a `type[T]` was assigned to a `Callable[..., T]`.

Bug Fix: Fixed a regression related to a recent change in typeshed that caused imports from `google.cloud` namespace packages to fail.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when assigning an unpacked TypeVarTuple to a regular (non-variadic) TypeVar during constraint solving. This should result in a union of the TypeVarTuple types.

Bug Fix: Fixed a bug that resulted in a false positive diagnostic when importing a symbol from a "py.typed" library that was imported (and re-exported) from a non-"py.typed" library.

Bug Fix: Changed ParamSpec capture logic to track the expression used for a default argument value.

Bug Fix: Fixed a recent regression that led to a false negative when evaluating the type of an unannotated variable in a loop.

Enhancement: Added support for `frozen_default` for `dataclass_transform`.

Bug Fix: Fixed recent regression that caused a false positive `reportShadowedStdlibModules` for relative imports and imports starting with `_`.

Enhancement: Show doc strings on hover over module names within import statements.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added small perf optimization for determining type compatibility between two unions, especially in cases where the number of items in the union is large.

Bug Fix: Added logic to limit recursion when handling type compatibility checks between two different recursive type aliases that have the same definition.

Bug Fix: Fixed bug that resulted in a false positive when passing an unpacked dict or unpacked iterable argument to the constructor of a class that has no `__init__` and therefore uses `object.__init__`.

Bug Fix: Fixed bug that led to a false positive error when using an unpacked argument that has a declared type that is a tuple with an unpacked TypeVarTuple.

Bug Fix: Fixed bug that resulted in a false positive `reportPrivateImportUsage` diagnostic when importing from a py.typed library under certain circumstances.

1.1.282

Bug Fix: Fixed bug that resulted in false positive error when a recursive type alias involving a union was used in certain circumstances.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when assigning a tuple with an unpacked TypeVarTuple to a tuple with a normal TypeVar.

Bug Fix: Fixed a bug that resulted in a false negative (a missing error) when assigning a union that contains a TypeVar to another union with the same TypeVar.

Bug Fix: Fixed bug that resulted in incorrect type inference for an instance variable that is assigned different types in different places.

Bug Fix: Fixed bug in tokenizer that resulted in false positive error when a floating point literal started with one or more leading zeros.

Bug Fix: Added logic to deal with conflicting namespace packages when one has no `__init__.py(i)` file and the other does.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that results in a false positive error when a dataclass field in a child class overrides a non-init dataclass field in a parent class.

Enhancement: Added code to report an error if a `from __future__ import x` statement is not found at the beginning of a file. This results in a syntax error.

Behavior Change: Changed `reportUnnecessaryTypeIgnoreComment` to to ignore ` type: ignore` comments if `enableTypeIgnoreComments` is set to false.

Bug Fix: Fixed a bug that led to an incorrect type evaluation when an empty list or dict literal is included in a list expression with an "expected type" (i.e. bidirectional type inference is being attempted).

Bug Fix (from Pylance): Fixed recent regression that caused false positive errors to appear when using a multi-root workspace.

1.1.281

Enhancement: Improved parse recovery for ternary expressions that are missing an `else` or a post-else expression.

Enhancement: Changed the implicit declared type of a module-scoped __doc__ to be `str` instead of `str | None` when a docstring is present at the top of the module.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when dealing with a union of an unpacked TypeVarTuple.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when dealing with a union of an unpacked TypeVarTuple.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when applying a solved unpacked TypeVarTuple in a Union.

Bug Fix: Fixed a bug that resulted in a false positive during protocol matching for a protocol that includes a property with a getter whose `self` parameter is annotated with a TypeVar.

Bug Fix: Fixed a bug that resulted in sporadic type evaluation errors when a quoted (forward-declared) type was used in a statement with an explicit PEP-613 `TypeAlias` annotation.

Bug Fix: Fixed bug that resulted in false positive errors when doing protocol matching for a recursive protocol definition. I needed to increase an internal recursion limit to support this.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed regression that resulted in errant `reportMissingImports` diagnostics within stub files.

Enhancement: Improved parse recovery when a suite contains an unexpected indent followed by a dedent that restores the indentation to that of the suite's body.

Bug Fix: Fixed a bug in the evaluation of the "with" statement that resulted in a false positive error when a class implements a context manager via its metaclass.

Bug Fix: Fixed a bug that led to a false positive error when validating the variance of type parameters for a protocol class when a covariant type parameter is used in a return type in the form `type[T_co]`.

Bug Fix: Fixed a bug that resulted in a false positive error when using a `cast` to a TypeVar.

Bug Fix: Fixed a bug in the type evaluator that could lead to unsolved TypeVars if used in a Callable parameter.

Bug Fix: Fixed recent regression that led to false positive `reportUnnecessaryCast` diagnostics.

Page 19 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.