Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 24 of 81

1.1.256

Enhancement: Improved error message generated when comparing two functions that return `TypeGuard` return types with incompatible types.

Bug Fix: Fixed false positive that occurs when overriding an abstract method (e.g. a property) with a field from a named tuple when both are used as base classes.

Behavior Change: Moved annotationNotSupported diagnostics under the reportGeneralTypeIssues diagnostic rule so they can be disabled.

Bug Fix: Fixed bug in `isinstance` type guard logic that resulted in incorrect narrowing when using a dynamic type or types for the second argument.

Bug Fix: Fixed a bug that resulted in a false positive when applying issubclass type narrowing from a `type` to an abstract class.

Bug Fix: Fixed a few inconsistent behaviors with incompatible redeclaration reporting. In particular, it's now OK to reassign a function if the assigned value is a compatible function. Also tightened up the special-casing for the symbol `_`, which is allowed to be redeclared only in the case where both declarations are functions (`def` statements). This exemption is provided for the single dispatch use case.

Bug Fix: Fixed a bug in the handling of `dataclass` where an existing `__eq__` method was being overwritten by a synthesized variant. The same was true for other comparison operators.

Bug Fix: Fixed bug that resulted in a false positive error when handling a generic TypedDict with a literal type argument.

1.1.255

Bug Fix: Fixed bug that results in a false positive error when evaluating type compatibility of a callable with a `*args: Any` and `**kwargs: Any` parameter with a callable that contains a ParamSpec.

Behavior Change: Exempted class members named `_` from the "reportIncompatibleMethodOverride" diagnostic check.

Bug Fix: Fixed bug that resulted in missing docstrings on an overloaded method when accessed through a member access expression.

Bug Fix (from Pylance): Auto-import should include import aliases from libraries.

Bug Fix: Fixed a bug that resulted in a false negative when performing protocol matching for a class instance when invariance is enforced.

Enhancement: Added support for overloaded functions that return a `TypeGuard` or `StrictTypeGuard` for some overloads.

Bug Fix: Changed heuristics in TypeVar constraint solver to handle a TypeVar bound to `LiteralString` and allow literal types to be retained when solving for this TypeVar.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that resulted in a false negative when assigning a union of `tuple[Any] | tuple[int]` to an incompatible type.

1.1.254

Enhancement (from Pylance): Use new detail description feature added in 3.17 LSP to show full module path for auto import.

Bug Fix (from Pylance): Make sure file watcher treats a zip file as a file not folder.

Enhancement: Added code to detect and flag usage of ` type: xxx` comments for `for` and `with` statements.

Enhancement: Added new configuration setting called "defineConstant". It allows a configuration to specify one or more identifiers that should be assigned by pyright's binder to be constant anywhere they appear. Values can be boolean (true or false) or a string. If an identifier of this value is used within a conditional statement (like `if not DEBUG:`) it will affect pyright's reachability analysis for the guarded code blocks.

Bug Fix: Fixed bug that resulted in a false negative when attempting to call `pop` on a TypedDict with a key that is required.

Enhancement: Added support for new `reportTypeCommentUsage` diagnostic check. It flag the usage of ` type: xxx` comments for functions and variables. These are still supported for backward compatibility, but they are increasingly irrelevant and will likely be deprecated in the next few years.

Bug Fix: Fixed a bug that resulted in a false negative when a variable with a declared type is overwritten by an incompatible type by an import statement.

Enhancement: Added code to print the pyright version as part of the CLI output. This is useful for diagnosis.

Bug Fix: Undid previous fix related to circular class dependency detection because it introduced a regression with sqlalchemy stubs. Implemented a different solution to detect circular class dependencies and handle them correctly.

Bug Fix: Changed the handling of partial stub packages to conform with PEP 561. They should always overlay the original package even if that package is marked "py.typed".

Bug Fix: Fixed bug in tokenizer that results in incorrect tokenization when a hex numeric literal is followed by a newline followed by either a 'b' or 'o' character.

1.1.253

Bug Fix: Fixed a bug that resulted in a false positive error when using an unpacked TypedDict for a **kwargs parameter annotation, and the caller passes an unpacked TypedDict as an argument but the argument is a subclass of the parameter's TypedDict.

Bug Fix: Fixed bug in "--dependencies" command-line option. When used with partial stub files, it was not emitting the correct paths.

Bug Fix: Fixed false positive error that occurs when using an `issubclass` type guard to narrow a type to an abstract base class. The resulting type should be instantiable without receiving a "cannot instantiate ABC" error.

Bug Fix: Fixed bug in type evaluator related to the handling of a recursive type alias that is self-referential. This resulted in various strange behaviors when this bogus type alias was later used as an annotation.

Enhancement: Enhanced bidirectional type inference for constructor calls to handle the case where a generic class has no `__init__` method but has a `__new__` method that informs the value of one or more type variables.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when an asymmetric property (where the getter type doesn't match the setter type) also has a deleter.

Bug Fix: Fixed bug in the "reportIncompatibleMethodOverride" check that results in a false positive if the parent class method has one or more keyword-only parameters and the override method has a kwargs of compatible type.

Bug Fix: Fixed a bug in the "reportIncompatibleMethodOverride" check that resulted in a false negatives when the override method accepted too few positional arguments but accepted a `**kwargs` parameter.

Bug Fix: Fixed a bug that resulted in spurious type evaluation errors when certain circular dependencies existed between class declarations. When evaluated in certain orders, a class type was being partially constructed with a corrupt MRO. This type was then cached and used in subsequent type evaluation steps, resulting in false positive errors.

Bug Fix: Fixed a bug that resulted in a false positive when using a captured variable within an inner function or lambda and the variable has been narrowed based on a `NoReturn` call within a conditional block.

1.1.252

Bug Fix: Fixed a false positive error when the special form `Unpack` is used in a context other than a type annotation.

Bug Fix: Fixed bug that resulted in a crash (due to infinite recursion) in reference provider under certain circumstances involving symbol renames.

Enhancement: Added check for a dataclass member that lacks a type annotation but is assigned a field descriptor. This combination results in a runtime exception in the dataclass implementation.

Behavior Change: Increased maximum number of declarations (assignments) to consider when inferring the type of an unannotated variable. It was previously 16, but it is now 64.

Bug Fix: Fixed bug in lambda type evaluation so it properly detects and reports when its type is incomplete due to recursion.

Bug Fix: Fixed regression in code flow analysis that depends on NoReturn call evaluation.

Bug Fix: Improved handling of calls to overloads that return NoReturn. If all overloads are annotated with NoReturn, the call is now evaluated as NoReturn. Previously, only the last overload was considered.

Bug Fix: Fixed bug that causes false positive when the evaluated type of a default argument used within a base class must be specialized for a derived class.

Bug Fix: Reduced the max number of recursive inferred function return results from 16 to 12 to address a crash (stack overflow) that appears in the pylance telemetry.

1.1.251

Bug Fix: Fixed a bug that results in a false positive when the return type annotation of a function requires code flow analysis to evaluate and a call expression is located on a code path between the function and the declared type referenced by the return type annotation. The fix is to skip "NoReturn" analysis in the code flow engine in this case (and several other similar cases) because it's not necessary. This has the added benefit of improving performance.

Bug Fix: Fixed misleading diagnostic message associated with `reportUnnecessaryComparison` check when `!=` operator is used in the expression.

Bug Fix: Added logic to better handle the case where a symbol is defined multiple times with a `TypeAlias` declaration. This is an error condition, but it does occur in some stdlib type stubs if pyright is configured to use "All" for the "pythonPlatform" setting.

Enhancement: Improved type verifier so it can target submodules that are installed using an editable install mechanism.

Performance: Added small performance enhancement for protocol matching. When a protocol mismatch is detected, the remainder of the members are skipped if the caller hasn't requested detailed diagnostic information.

Performance: Added protocol matching optimization for the case where the source type and the destination protocol are both non-generic classes. In this case, we can safely cache the protocol relationship and shortcut future checks.

Bug Fix: Fixed bug in type narrowing logic for expressions of the form "X not in Y".

Bug Fix: Fixed a bug in the `isinstance` and `issubclass` type narrowing code paths. They were not handling nested tuples for the second argument.

Enhancement: Extended the "X in Y" type narrowing to support `dict`, `defaultdict` and `OrderedDict` classes.

Bug Fix: Fixed bug that resulted in a false positive error when using `==` or `!=` operator with `type(None)`.

Bug Fix: Fixed a bug that led to a false negative in some instances when assigning an inappropriate type to a TypedDict key.

Bug Fix: Fixed a bug that led to a false positive when assigning a value to an index expression where the base type of the index was inferred rather than declared.

Bug Fix: Fixed a bug in completion provider that resulted in incomplete member suggestions when a `LiteralString` type is used.

Bug Fix: Fixed a bug that resulted in a false positive error when evaluating an expression `a + b` where a is a `LiteralString`. For purposes of binary expression evaluation, `LiteralString` should act like a `str`.

Page 24 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.