Skip to content

Published 1.1.306

Compare
Choose a tag to compare
@github-actions github-actions released this 03 May 02:29
· 1333 commits to main since this release

Enhancement: Improved type evaluation of yield from expression so it handles operands that are unions.

Bug Fix: Added code to handle the case where a module uses an from A.B.C import X statement within the A/B/C/__init__.py module.

Bug Fix: Fixed a type evaluation bug that produces a false positive when using bidirectional type inference for nested call expressions when the target callables are generic.

Behavior Change: Reduced the default output of the CLI.

Bug Fix: Fixed a bug in the isinstance and issubclass type narrowing when the types have no overlap and one or both is @final. In this case, the narrowing should result in a Never rather than an intersection type.

Bug Fix: Fixed a bug that resulted in a false positive error when constructing a tuple of classes in the second argument of an isinstance or issubclass call.

Bug Fix: Fixed a bug that resulted in false positive errors when overlapping roots were used in a multi-root workspace and new workspaces are added after one of these shared files was already open in the editor.

Bug Fix: Fixed a bug that resulted in a false positive error when doing protocol matching when there are multiple levels of protocol inheritance and a method that uses Self in its signature.

Bug Fix: Fixed inconsistent evaluation of a class type when calling a generic constructor that accepts a type[T] parameter and a union of classes is passed as an argument.

Behavior Change: Changed the behavior of the reportIncompatibleMethodOverride check to exempt the case where the base class or override has a type that is defined by Callable[..., X]. The ... means that it's compatible with any signature. Also fixed a false negative in this check where the base method contains a **kwargs parameter but the override does not.

Bug Fix: Fixed bug that caused useLibraryCodeForTypes to default to false in the CLI if it was not overridden in the config file. Version 1.1.305 was intended to change the default to true, but it didn't.

Bug Fix: Fixed a confusing and inappropriate diagnostic addendum when a function with positional-only parameters is assigned to another function with positional-only parameters but has a parameter count mismatch. The old logic output an inappropriate message about a keyword-only parameter.

Bug Fix: Fixed a bug in the --verifytypes command-line tool that affected the case where a submodule was specified (e.g. --verifytypes a.b.c) and the final nested module was a single file (e.g. c.py) rather than an __init__.py within a folder.

Enhancement: Added support for a generic NamedTuple class — i.e. a class that uses NamedTuple as a base class along with type parameters defined in a Generic[...] base class and then uses these type parameters in type definitions for the NamedTuple entries.

Enhancement: Implemented check for conditional statement operands. Such operands must support a __bool__ method that returns a bool return type. Any other type is treated as an error by the runtime.

Enhancement: Added special-case handling for methods within generic classes parameterized by a ParamSpec when those methods use *args: P.args, **kwargs: P.kwargs in their signature and the callable signature captured by the ParamSpec is from a generic function. In this case, the TypeVar scope of the captured function is retained so its type variables can be solved when the method is solved. This is useful for generic callback protocol classes that implement a __call__ method.

Enhancement (by debonte): Added provisional support for draft PEP 712, which introduces support for a converter parameter in a field descriptor for dataclass and dataclass_transform.

Bug Fix: Eliminated the code that treats unions within value expressions as a UnionType object. This behavior caused various problems including a false positive in some cases.