Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 33 of 81

1.1.204

Behavior Change: Added special-cased handling for `__slots__` and `__class_getitem__` in protocol matching logic.

Enhancement: Improved bidirectional type inference for lambdas with default argument values.

Enhancement: Improved heuristics for when constraint solver should prefer literals over non-literals when solving a TypeVar in the case of bidirectional inference when assigning to a callable type.

Enhancement: Added support for unpacking of tuples in type annotations (part of PEP 646).

Bug Fix: Fixed bug that resulted in false positive error when a `Literal` was used within a Python-2 style type annotation comment.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug in "x is None" type guard logic. It wasn't preserving conditional types if x was a TypeVar.

Bug Fix: Fixed bug that resulted in false positive error when a constrained TypeVar was checked against a particular constraint in an `isinstance` type guard.

Bug Fix: Fixed a bug in the logic for assignment-based type narrowing that resulted in the wrong narrowed type if the declared type of the destination expression contained a union and the source contained a TypeVar.

1.1.203

Happy New Year everyone!

Bug Fix: Fixed false positive error when `Optional` is used outside of a type annotation with no type arguments.

Enhancement: Added provisional support for "asserting type guard functions", those that return a type of `TypeGuard[X, NoReturn]`.

Enhancement: Added support for type narrowing in pattern classes based on the absence of an attribute (or a pattern mismatch of an attribute) if the class in question is marked `final`.

Behavior Change: Changed the behavior for wildcard imports when the target module defines `__all__` in a way that pyright cannot understand. Previously, the wildcard import didn't import any symbols in this case. Now, it imports all symbols from the target module.

Enhancement: Added support for undocumented behavior of functools.partial whereby it allows keyword parameters to be overridden by the caller even though they are already supplied in the `partial` decorator.

Behavior Change: Changed the reportImplicitStringConcatenation diagnostic check to not flag concatenated strings if they are contained within enclosing parentheses.

Bug Fix: Fixed bug that caused `__hash__` function not to be synthesized for frozen pydantic models when using `dataclass_transform`.

Enhancement: Enhanced the "aliased conditional" type narrowing capability to accommodate multiple assignments of the variable used within the aliased conditional as long as the variable isn't reassigned between the the aliased conditional assignment and the conditional check that uses the aliased value.

Enhancement: Added support for `bool(x)` type guard.

Bug Fix: Fixed several bugs that prevented type narrowing to work correctly when conditional expression included an assignment expression.

Enhancement: Added check for member access expressions that access a member of a protocol class directly from the class. In this case, the member must be declared as a ClassVar.

Enhancement: Improved "x in y" type narrowing logic to better handle literal types in the iterable value y.

Behavior Change: Adjusted heuristics for assignment-based type narrowing. If the RHS type contains an unsolved TypeVar and the LHS (declared) type is concrete, do not apply type narrowing in this case.

Bug Fix: Fixed bug that resulted in unreported type violation (false negative) when an inner function with a ParamSpec used a concatenated parameter but the outer function's return type did not.

Enhancement: Added support for new type narrowing pattern: `len(x) == L` and `len(x) != L` where `x` is a tuple or union of tuples and `L` is a literal integer value.

1.1.202

Enhancement: Added check for class patterns for special builtin types (like int, float, etc.). These class patterns accept at most a single sub-pattern as an argument, and it must be positional.

Bug Fix: Fixed type compatibility bug that allowed `Literal[1]` to be assignable to `type` when it should not be.

Bug Fix: Fixed bug that caused "unnecessary isinstance" check to emit a false positive diagnostic when second argument was `Literal[1]`.

Enhancement: Improved heuristics for determining preferred TypeVar match when matching against a union that includes a TypeVar.

Enhancement: Added provisional support for two-argument form of TypeGuard to support negative narrowing cases.

Bug Fix: Fixed bug in hover provider that caused docstrings not to appear for callable types that were generated from a callable with a ParamSpec.

Bug Fix: Fixed a bug that resulted in a missing type error when a generic function returned a Callable type that used a TypeVar in its parameter types.

Bug Fix: Fixed regression that resulted in a crash under certain circumstances where a `finally` clause was used in a generic function that used constrained TypeVars.

1.1.201

Enhancement: Added code to detect except clauses that are unreachable because their exception types are already handled by previous except clauses.

Enhancement: Added type validation for custom metaclass keyword parameters specified in the metaclass's `__new__` method.

Enhancement: Added type validation logic for dataclass `__post_init__` method.

Bug Fix: Fixed bug that results in false positive error when class declaration arguments are evaluated out of order.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support for `Required` and `NotRequired` type annotations in alternative syntax form of TypedDict.

Behavior Change: Changed overload implementation consistency check so it doesn't require the implementation to include a `NoReturn` if one of the overload signatures returns a `NoReturn`.

Bug Fix: Fixed a bug that resulted in a false positive in the overlapping overload check, specifically when a later overload used a type variable in a parameter annotation.

Enhancement: Added type checking support for functools.total_ordering.

1.1.200

"The Christmas Edition"

Enhancement: Added type checking support for functools.partial. This advanced support does not work with overloads or argument lists that include list or dictionary unpack operators.

Bug Fix: Fixed a bug that resulted in a ParamSpec used within a generic function from becoming `Unknown` in some circumstances.

Bug Fix: Fixed a bug that resulted in an incorrect specialized return type in certain cases involving ParamSpecs.

Bug Fix: Fixed bug that can result in incorrect type evaluations when a keyword argument name is evaluated first when hovering over it.

Behavior Change: Added special-case handling to accommodate assignment of a method that differs only in the Self parameter.

Enhancement: Added logic to preserve function doc strings for a ParamSpec when it captures the signature of a function with a doc string. This is useful for decorators.

1.1.199

Bug Fix: Fixed bug that resulted in false positive error when class constructor is invoked with more than one argument and the class's metaclass has a custom `__call__` method.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed recent regression that resulted in false positive when assigning a `Type[Proto]` to `Type[Proto]`.

Enhancement: Added type checking for class constructor calls when the class has a metaclass with a custom `__call__` method.

Bug Fix: Fixed a bug that resulted in an incorrect type inference when assigning to a list that includes an unpacked target variable.

Enhancement: Improved handling of call expressions that have a `NoReturn` type. In particular, the logic now handles constructors, `__call__` methods, inferred symbol types, and symbol import chains.

Bug Fix: Fixed bug that resulted in infinite recursion in certain cases when an aliased conditional expression was used.

Bug Fix: Fixed bug in type evaluator that masked certain type errors when assigning a concrete type to a class TypeVar type.

Bug Fix: Fixed bug that caused false positive when passing a generic function callback as an argument to another generic function.

Page 33 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.