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.