Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 27 of 81

1.1.238

Bug Fix: Fixed a bug that generated a false positive when importing from a "py.typed" namespace package. This change also loosens the requirements for a "py.typed" file to be in each of the submodules within a namespace package; a single "py.typed" within the top-level namespace directory is also now supported.

Enhancement: Improved error message for protocol mismatch due to invariance of mutable attributes.

Bug Fix: Fixed bug in type evaluation of a generic type alias that refers to a generic `Callable` and is missing explicit type arguments. The type argument should implicitly be `Unknown` in this case.

Enhancement (contribution from Robert Craigie): Add support for showing key on hover for unions of TypedDicts.

Bug Fix: Fixed recent regression that broke the `--watch` mode of the cli version of pyright.

Bug Fix: Fixed an infinite recursion crash that occurs within the code flow engine in rare circumstances.

Bug Fix: Fixed bug that resulted in a false positive error when assigning certain value types to a property's setter.

Bug Fix: Fixed a bug that resulted in a false negative when solving for a ParamSpec. The type analyzer wasn't generating an error when multiple assignments to a ParamSpec were incompatible.

Bug Fix: Fixed bug in constraint solver logic that resulted in a crash in certain edge cases.

Bug FIx: Fixed bug that resulted in incorrect type evaluation in cases where a decorator returned a generic `Callable[[U], U]` and this decorator was applied to a function with one or more parameters that were typed with a union that included a "raw" type variable, such as `func(x: T | list[T])`.

1.1.237

Bug Fix: Fixed recent regression that results in a false positive when evaluating `*P.args` and `**P.kwargs` argument types passed to a function within a nested inner function.

Bug Fix: Fixed bug that resulted in false positive with the reportOverlappingOverload diagnostic check when a parameter in one overload is annotated with `type` or `Type[Any]` and the corresponding parameter in another overload is annotated with `Any`.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when an import statement failed to resolve and targeted a submodule of a previous import statement, such as `import a.b` followed by `import a.b.c` where `a.b.c` couldn't be resolved. In this circumstance, pyright "forgot" that `a.b` had been resolved previously, so all symbols imported from `a.b` were evaluated as `Unknown`.

Enhancement: Enhanced reportUnnecessaryComparison diagnostic check so it also detects cases where a function appears within a condition expression. This is a common source of programming error.

Bug Fix: Fixed bug that resulted in a false positive error when validating the variance of a type variable used within a protocol class. It specifically affected the case where a TypeVar was used in the return type of a read-only property.

Bug Fix: Fixed a bug that resulted in a false negative when validating arguments to a function that uses a specialized TypeVar within an unpacked tuple as an `*args` parameter type.

Enhancement: Expanded the `reportUnknownVariableType` check to cover some cases that it didn't previously. It now handles unknown or partially-unknown symbols imported from `from a import b` statements, unpacked assignments, `with a as b` statements, and more.

Bug Fix: Fixed a bug that resulted in a runtime assertion (and crash) when dealing with return expressions that involve more than one constrained TypeVar.

1.1.236

Performance: Improved performance of code flow analysis.

Bug Fix: Fixed inconsistency in type printer when outputting a callable with an Optional return type.

Bug Fix: Fixed bug that resulted in incorrect "unreachable code" when a match statement contained a guard expression that statically evaluates to True.

Bug Fix: Fixed a bug that caused a false negative with the reportMissingTypeArgument check when used with a member access expression where the LHS is a module.

Bug Fix: Fixed false negative when a class variable of type `type[T]` is specialized to `type[Any]` and then assigned a value in a base class that is not compatible with `type[Any]`.

Bug Fix: Fixed a type evaluation bug that occurs when a constructor uses a class-scoped ParamSpec and uses `*args: P.args` and `**kwargs: P.kwargs` parameters.

Bug Fix: Added exception handling to recover from errors thrown by the YarnFS (zip handling library).

Bug Fix: Fixed regression that resulted in an incorrect `Unknown` type evaluation for a variable within a loop.

Bug Fix: Fixed a recent regression that resulted in incorrect type evaluation within a loop with dependency chains between variables.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed a bug related to specialization of a generic class that uses ParamSpec when the type argument corresponding to the ParamSpec is unspecified. In this case, the ParamSpec should receive a "default" signature `(*args: Any, **kwargs: Any)` — the ParamSpec equivalent of `Any`.

Bug Fix: Fixed a bug that resulted in a false negative in the type consistency checks for functions with a ParamSpec.

Bug Fix: Fixed a bug that resulted in a false negative when calling a function that includes a ParamSpec from within an inner function. The code was not verifying that `*args` and `**kwargs` with the appropriate ParamSpec type were passed as arguments.

Bug Fix: Fixed bug that resulted in a false negative when dealing with a mutable instance or class variable in a Protocol class. Such variables need to be treated as invariant when performing protocol compatibility checks.

1.1.235

Performance: Fixed a performance regression that manifested when analyzing a large dictionary literal statement with a declared type.

Enhancement: (Contributed by Robert Craigie) Show TypedDict key type and docstring on hover.

Behavior Change: Updated logic for `dataclass_transform` to handle recent clarification in PEP 681 for cases where one or more overloads are decorated with `dataclass_transform`.

Enhancement: (Contributed by Kevin Coffey) Added support for type guard based on `a.b is None` or `a.b is not None` patterns where `b` is a member variable that distinguishes two different classes.

Enhancement: (Contributed by Robert Craigie) Add support for going to definition for TypedDict keys.

Behavior Change: Changed hover provider to display `(property)` rather than `(method)` if the field is decorated with a descriptor object.

Enhancement: Changed logic for hover and completion providers to support docstrings for general descriptors rather than just properties.

Enhancement: Made synthesized `get` method in `TypedDict` classes a bit smarter. If a field is required, the default parameter's argument (or `None` if no default argument is provided) is ignored because the type will always come from the required field. If the `TypedDict` class is marked `final`, any literal key name that is not part of the class will always return the type of the default argument (or `None` if no default argument is provided).

Bug Fix: Fixed bug that could theoretically account for some of the remaining stack overflows that we're seeing in the pylance telemetry.

Bug Fix: Fixed bug in the package type verifier where it incorrectly flagged an assignment to a descriptor member within a child class as an ambiguous override of that member.

Bug Fix: Changed the way pyright detects high memory usage and decides to empty its internal type cache.

Performance: Added perf enhancement to improve analysis times for complex unannotated code. Lowered complexity threshold for call-site return type inference and skipped argument expression evaluation for call expression when base call expression type is unknown.

Performance: More performance optimizations for complex unannotated functions. Don't evaluate argument or subscript expressions if base type of call expression or index expression is incomplete.

Enhancement: Updated typeshed stubs to latest.

1.1.234

Performance: Fixed bug that resulted in long analysis times when using call-site type inference for very complex functions that have no parameter annotations.

Behavior Change: Removed support for `transform_descriptor_types` parameter in `dataclass_transform`, a feature that was determined to be not necessary. Added support on normal dataclass handling for field types that are custom descriptor objects.

Bug Fix: Fixed bug in logic that determines whether to empty the in-memory type cache if it has the potential to overflow the heap.

Enhancement: Improved printing of string nodes in error and log messages. If the string node is long, it is truncated to 32 characters.

Enhancement: Improved textual form of string literal types. If the string literal is very long (>50 characters), it is truncated.

Bug Fix: Fixed recent regression that caused the "--verifytypes" feature to incorrectly report that the "self" parameter of a `property` method as unannotated.

Performance: Removed older mechanism for tracking "incomplete types" — those that have been partially evaluated within a code flow loop. The older mechanism is no longer needed. Removing this is a big performance win in some (typically more complex) pieces of code.

Performance: Fixed performance issue that caused long analysis times in some complex unannotated functions when attempting to infer whether the function was a NoReturn return type.

Performance: Improved performance of code flow "reachability" analysis.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed false positive error in "unreachable exception" detection code when the exception was typed as `Type[Exception]`.

Enhancement: Contributed by Kevin Coffey - Extended `a[I] is None` type narrowing logic to handle subtypes of Tuple including NamedTuple.

1.1.233

Behavior Change: When hovering over the LHS of an augmented assignment (e.g. the `a` within `a += x`), reveal the type of the symbol _after_ the operation rather than _before_.

Enhancement: Updated the `reportUnusedExpression` check to also report diagnostics for a simple name expression as a standalone statement.

Bug Fix (from pylance): Fixed several bugs related to "Rename Symbol" command and improved performance in some cases.

Bug Fix: Fixed crashing bug due to stack overflow when traversing the code flow graph.

Behavior Change: Modified algorithm for calculating the complexity of a function's code flow. If the complexity exceeds a certain threshold, pyright will not attempt to analyze the code.

Bug Fix: Fixed a bug that resulted in incorrect import resolution when the import referenced an empty directory within the stubspath. It should continue searching for imports in other locations in this case.

Bug Fix: Fixed regression that caused false positive error when protocol match involved a property that returned a type that was generic.

Bug Fix: Fixed bug that resulted in a false negative when assigning an invariant type var was specialized with a protocol type.

Bug Fix: Fixed several bugs relating to type evaluation within loops. This is a significant change to the code flow engine logic.

Page 27 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.