Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 26 of 81

1.1.244

Bug Fix: Fixed bug that resulted in a false positive when a callback protocol used a method-scoped ParamSpec in its `__call__` method.

Enhancement: Improved error message for a call expression that uses a named argument when the target callable has no such named parameter.

Enhancement: Enhanced the reportUninitializedInstanceVariable check to detect cases where a class variable is declared but not initialized in the class body and no instance variable of the same name is assigned in the `__init__` method.

Bug Fix: Fixed bug that resulted in the incorrect inferred type for an exception group that results when using a Python 3.11 `except*` statement.

Bug Fix: Fixed a bug that resulted in a crash when overflowing the type cache. It is implemented with a Map, which has a limit of 2^24 entries. The fix is to empty the cache if we approach this limit.

Bug Fix: Changed heuristic for type matching when source is a concrete type and destination is a union of that type and a TypeVar. The old heuristic attempted to solve the TypeVar, but the new heuristic leaves it unsolved. This eliminates a false positive error in certain edge cases and more closely matches the behavior of mypy in this case.

Bug Fix: Fixed bug that resulted in incorrect type analysis for dataclasses when a field declaration was within a conditional block.

Enhancement: Added support for generic NamedTuple classes, which are now supported in Python 3.11.

Bug Fix: Fixed bug that resulted in incorrect type evaluation of a dictionary key when assigning a dictionary expression to a dict with a generic key type.

Enhancement: Improved error message for incompatible field types in a TypedDict.

Enhancement: Added basic support for generic TypedDict classes, which are supported in Python 3.11. Assignment to a specialized generic TypedDict is now supported, but support for TypeVar solving is not yet in place.

1.1.243

Bug Fix: Fixed bug that resulted in incorrect type evaluation when referencing a descriptor object that is stored as an instance variable.

Bug Fix: Fixed a bug that resulted in incorrect import resolution in a library that you are debugging locally if that library is also installed in the current Python environment and the library includes stub (".pyi") files.

Bug Fix: Fixed a bug that resulted in false positive errors during protocol matching when a generic protocol derives from another generic protocol.

Bug Fix: Fixed a long-standing bug in protocol matching where results were evaluation-order-dependent in cases where a generic source class included a method with an inferred return type that was dependent on one or more TypeVars. If the return type was not inferred and cached prior to protocol matching, it was improperly specialized.

Enhancement: Added check for illegal use of `ClassVar` within a `TypeAlias` declaration.

Bug Fix: Fixed a bug that resulted in a false positive error when performing protocol matching with a property whose getter included a custom type annotation for its `self` parameter.

Bug Fix: Fixed a recent regression that broke list and dictionary inference in cases where bidirectional type inference was used with an expected type that included a TypeVar that was bound to a literal type or a union of literals.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when function return type inference resulted in various recursive cases.

Bug Fix: Fixed long-standing bug that resulted in incorrect code flow analysis and type evaluation when handling some forms of `NoReturn` calls. There are still some limitations though; for example, it doesn't handle overloaded functions that return NoReturn for some argument lists.

1.1.242

Performance: Improved performance of import cycle check by adding caching.

Enhancement: Removed limitation that `Literal` must be imported directly from `typing` or `typing_extensions`. It can now be re-exported from another library, although analysis performance will suffer a bit in that case.

Enhancement: Improved error message for CLI version of pyright when it is passed a file that is not a Python source file.

Bug Fix: Fixed bug that resulted in infinite recursion and a crash in rare circumstances involving a `self` parameter annotation that referred to its own class.

Bug Fix: Fixed a bug that resulted in inconsistent type evaluation depending on evaluation ordering when a parameter or return type annotation involved a `|` (union) operator.

Bug Fix: Fixed bug that resulted in wrong ordering of type parameters in a generic protocol if `Protocol[...]` was meant to specify an explicit ordering, similar to the way `Generic[...]` specify an explicit ordering.

Bug Fix: Fixed bug that led to inconsistent type evaluation results when the code flow engine determined that an expression was unreachable. The results differed depending on whether there was a branch between the expression and point of the graph that was unreachable.

Bug Fix: Fixed bug in stub generator that resulted in code that was syntactically incorrect when an index subscript contained an extra "hanging" comma.

Bug Fix: Fixed a bug in the stub generator logic that produced syntactically incorrect code when the source file contained a function with a position-only separator in its signature.

Bug Fix: Fixed a bug that led to a false positive "reportOverlappingOverload" error when the return type of two overlapping overloads both used a generic return type.

Enhancement: Extended type guard for discriminated literal fields to support properties.

Bug Fix: Fixed bug in expression printer for lambda expressions. It was not properly printing a position-only separator.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when using a generic type alias with an instantiable class (as opposed to a class instance) when the TypeVar used within that type alias was bound to a `type[x]`.

Enhancement: Updated typeshed stubs to the latest version.

1.1.241

This is a quick-spin release that addresses two regressions introduced in the previous release:

Bug Fix: Fixed regression in "reportUnnecessaryComparison" diagnostic check that resulted in false positives when the LHS or RHS evaluated to `Never`.

Bug Fix: Restored compatibility with node 12.x. A dependency was updated in the previous build that assumed node 14 or newer, resulting in a crash when running on older versions of node.

1.1.240

Enhancement: Enhanced reportIncompatibleMethodOverride check to detect cases where a staticmethod, classmethod or instance method override a method that doesn't match in that regard.

Bug Fix: Added check for complex code blocks (that contain hundreds of if/elif statements within loops). These now emit an error rather than resulting in tens of seconds of compute.

Bug Fix: Fixed bug that resulted in combinatoric explosion within a union when using literals in an augmented assignment. This led to crashes in extreme cases.

Bug Fix: Added limit to the number of recursive function return type inference operations that can be pending concurrently. Theoretically, this could be arbitrarily deep, which will eventually overflow the call stack and crash. Such a crash is showing up in the pylance telemetry. We now limit it to 16 levels deep to prevent this crash.

Bug Fix: Fixed a bug that resulted in the incorrect type evaluation for a member expression when the LHS type was a `Type[T]` type.

Bug Fix: Fixed bug that caused a crash when the setter for a descriptor class had only two parameters and was used in a class variable for another class.

Performance: Implemented small perf improvements to core union functions, which are hot paths in the type analyzer.

Bug Fix: Fixed a bug that resulted in false negative errors during protocol matching when a method within the protocol contained a keyword-only parameter annotated with a class-scoped TypeVar.

Bug Fix: Fixed bug in type evaluator that resulted in an errant `Unknown` type when evaluating a dependent variable assigned through a tuple within a loop.

Bug Fix: Fixed bug in code flow engine that results in infinite recursion and a stack overflow under certain circumstances.

Bug Fix: Fixed bug that resulted in inconsistent behavior when a TypeVar was used as the value for a magic method and was explicitly or implicitly set to `Any` or `Unknown`.

Bug Fix: Fixed a false positive error related to `__slots__` usage within a dataclass.

Bug Fix: Fixed bug in static expression evaluator that resulted in incorrect evaluation when using the `not` unary operator.

Bug Fix: Improved type evaluation for expressions that are determined to be unreachable. Such code should evaluate to the type `Never` and never generate errors or warnings.

1.1.239

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug that resulted in an infinite loop when a reference to a generic function was passed to itself as an argument.

Page 26 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.