Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 17 of 81

1.1.298

This is a hot-fix release to correct a regression introduced in 1.1.297.

Bug Fix: Fixed a regression that resulted in a false positive in some rare cases when attempting to assign a value to a property with a defined setter.

Enhancement: Updated typeshed to the latest stubs.

1.1.297

Enhancement: Extended logic that searches for `site-packages` directory within a venv to handle the case where multiple `/lib/python3.X/site-packages` are present. The new logic prefers the configured Python version rather than picking the first one returned by the file system.

Enhancement: Added support for bidirectional type inference for dictionary expressions with dictionary expansion entries.

Bug Fix: Fixed a bug that led to a false positive error when using the `|` operator with two dicts whose keys or values are defined as literals.

Bug Fix: Fixed a recent regression that resulted in an incorrect type evaluation when using a `__new__` method whose return type annotation is `Self`.

Enhancement: Implemented missing check for generic type alias specialization when too few type arguments are provided.

Bug Fix: Fixed a bug that resulted in a false negative when defining a generic class that derives from another generic class and the type parameter isn't compatible with the variance of the base class.

Bug Fix: Added logic to detect when a type alias is used in a generic class declaration's base class list and a type parameter used with the type alias is incompatible with the variance required for the type alias.

Bug Fix (contribution by Michael Davis): Declare workspaceFolders support in LSP server capabilities.

Performance: Performance optimization: reduced formatting of error messages in cases where it can be determined that they are not needed (e.g. in speculative evaluation code paths).

Bug Fix: Fixed a bug that caused the variance for type parameters to be incorrectly inferred when an auto-variance class derived from a non-auto-variance class.

Enhancement: Added support for type guard patterns `type(x) == T` and `type(x) != T`.

Enhancement: Improved error handling for dictionary expressions that use bidirectional type inference when the key type doesn't match the expected type.

Enhancement: Improved handling of `typing.TypeAlias` so it can be aliased and re-exported from other files.

Bug Fix: If no files are found and no errors are detected but the `--outputjson` command-line option is used, a json report should still be issued.

Bug Fix: Made JSON parsing stricter for the pyrightconfig.json file. Previously, a JSON syntax error was not detected or reported.

Enhancement: Removed the need for the binder to understand `typing.Required` and `typing.NotRequired` special forms. This allows these forms to be imported, re-exported, and aliased.

Bug Fix: Fixed a bug that resulted in an incorrect reporting of "unreachable code" after a call to a generator function that contains an unreachable yield statement.

Performance: Fixed performance issue that affected long if/elif chains.

Bug Fix: Fixed bug that resulted in incorrect type evaluation of arguments to `functools.partial` call along with false positive errors. The problem is that the special-case logic for `functools.partial` was not applying bidirectional type inference when evaluating the arg type.

Behavior Change: Changed import modeling behavior for import statements with multi-part module names. The statement `import a.b.c` now implies `import a; import a.b; import a.b.c`. This also affects import cycle detection because these implicit imports are now part of the import graph.

Bug Fix: Fixed a bug that led to a false positive error when using a subclass of `type` as a base class in a class declaration.

Behavior Change: Changed `reportSelfClsParameterName` check to accept `mcs` and `mcls` for first parameter in an instance method within a metaclass (i.e. a subclass of `type`).

Bug Fix: Fixed bug that resulted in the incorrect type evaluation for a function or method that returns `Union[*Ts]` where `Ts` is a TypeVarTuple bound to `*tuple[()]`.

Bug Fix: Fixed regression in `--verifytypes` where variables assigned from calls to `TypeVar`, `ParamSpec`, `TypeVarTuple`, `NewType`, `TypedDict`, and `NamedTuple` were marked as ambiguous.

Enhancement: Added an error message for `Concatenate` if a `TypeVarTuple` is used in the concatenated list of types.

Bug Fix: Fixed a bug whereby the signature help and hover text for an overloaded method would adopt its class docstring rather than the docstring for its own implementation.

Enhancement: Added check and corresponding error for use of an unpacked tuple in a `Concatenate`.

Bug Fix: Fixed several bugs relating to types of callables (functions, methods, lambdas). There were bugs in the type printer, call expression evaluator, and param spec specialization logic.

Enhancement: Added experimental support for inlined TypedDict definitions using the `dict[{'a': int}]` syntax.

1.1.296

Bug Fix: Fixed a bug that resulted in a false positive when determining the correct variance of a TypeVar used within a class.

Bug Fix: Improved type inference of method calls on `super()` so `Self` is generated rather than the concrete class.

Bug Fix: Fixed regression in import resolver that resulted in spurious "stub not found" diagnostics.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation of augmented assignments used in loops in some cases.

Bug Fix: Addressed a performance issue that resulted in long evaluation times when a variable was used in a loop but was not initialized prior to the loop.

Enhancement: Improved support for ternary expressions that use a statically-evaluatable condition expression.

Enhancement: Enhanced the `reportUnnecessaryComparison` to check for unused patterns in a `match` statement.

Bug Fix: Fixed bug that caused a false positive when a variable of type `type` is used as an argument to a class declaration.

Bug Fix: Changed logic to treat `self` and `cls` parameters as positional-only for purposes of protocol matching.

Bug Fix: Fixed bug that resulted in a false positive error with `assert_type` when the evaluated type involved a pseudo-generic class.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added diagnostic check for when unknown or partially-unknown type is captured by a wildcard pattern in a match statement.

Enhancement (from pylance): Added module name to moduleUnknownMember diagnostic.

Performance: Improved performance by not inferring return type of overloaded implementation when binding an overloaded method to an object.

1.1.295

Behavior Change: Updated the handling of type narrowing for class pattern matching in cases where a class subclasses from one of the special built-in types listed in PEP 634 as treating a single positional argument as matching the entire subject. The behavior of the CPython implementation deviates from the PEP in this manner, but the implementation takes precedent over the spec in this case.

Bug Fix: Fixed a bug that led to false positive errors when evaluating comparison operator overrides (e.g. `__eq__` or `__lt__`) in cases where the LHS type didn't support the comparison but the RHS type did.

Enhancement: Added logic to exempt a `self` with annotated type `Never` from the check that verifies the `self` type is a subtype of the class.

Bug Fix: Fixed a bug that resulted in an incorrect inferred function return type when one or more of the return statements returned an expression based on an empty container (`{}` or `[]`).

Bug Fix: Fixed a bug that caused a `Final` variable to lose its literal value when imported from another file.

Bug Fix: Fixed a bug that resulted in a false positive "overlapping overload" diagnostic in certain cases.

Bug Fix: Fixed a bug that resulted in a false positive diagnostic when using a TypeVarLike with a default value by itself in a function signature.

Bug Fix: Fixed issue that caused the type of `None.__class__` to be evaluated incorrectly with new typeshed definition of `object.__class__`.

Enhancement: Updated typeshed stubs to the latest.

Enhancement (contribution by Declan Brady): Added parameter documentation on hover from function docString.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when a `__new__` is called and is bound to a class that is different from the `cls` argument passed to it.

1.1.294

Bug Fix: Fixed a bug that led to a false positive error when using a type alias within an `__init__` or `__hash__` method in a dataclass.

Bug Fix: Fixed a false negative where a variable used within a `TypeAlias` definition was not flagged as an error.

Bug Fix: Fixed false negative error where an attempt to assign a value of type `type[T]` to type `T` was not flagged as an error.

Bug Fix: Fixed a bug that results in a false positive error when using `Self` in a type annotation for a parameter with a default value.

Behavior Change: Removed typeshed tensorflow stubs because they're too incomplete at this time.

Enhancement (from pylance): Added completions and signature help for unpacked kwargs (PEP 692).

Behavior Change: Change dataClassFieldWithDefault from error to reportGeneralTypeIssue diagnostic so it can be disabled.

Bug Fix: Fixed bug that resulted in a false positive error when calling `type(None)()`.

Enhancement: Improved error handling for constructor call to `NoneType`.

Bug Fix: Fixed bug that led to incorrect type evaluation when a yield statement was used in conjunction with a declared `Iterator` return type.

Enhancement: Added error reporting for malformed ` pyright` comments.

Bug Fix (from pylance): Fixed recent regression in hover text for variable whose type is `Unknown`.

Bug Fix: Fixed a bug that resulted in a false positive when accessing an instance method from a metaclass (i.e. a class that derives from `type`) if the `self` parameter of that instance method is annotated with a `type[T]` annotation.

1.1.293

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when accessing instance methods directly from a `None` instance.

Bug Fix: Fixed a regression that resulted in a crash when resolving overloads with different numbers of parameters and with with arguments that evaluate to `Any`.

Bug Fix: Fixed a bug that resulted in an inconsistent "import not accessed" diagnostic based on evaluation ordering.

Bug Fix: Tweaked the "type complexity" heuristic to produce more intuitive results in the constraint solver.

Enhancement: Added specialized logic to better handle imports of the form `from .x import x` where `x` is later referenced from an inner scope within the module.

Enhancement (from pylance): Modified class and function signatures to make them more textmate compatible.

Enhancement: Improved handling of a class declaration that uses a dynamic unpacked argument type to define its base classes.

Bug Fix: Fixed a bug that resulted in a false positive error and incorrect type evaluation when a lambda is evaluated with an incomplete "expected" type.

Bug Fix: Fixed false negative bug when checking for valid use of identifiers within a type annotation. Variables used within a type annotation should always generate an error, even if the variable is imported from another file.

Bug Fix: Fixed a bug that led to a false positive error when a magic method (such as in a binary operation) was used with bidirectional type inference.

Enhancement: Added error for a dataclass that uses a private attribute name that appears within a synthesized `__init__` method.

Enhancement: Implemented support for overloaded functions captured by a ParamSpec.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug in signature help that resulted in incorrect or misleading signature for a constructor call when the `__init__` method accepts no arguments.

Page 17 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.