Behavior Change: This change may require changes to your configuration. Changed the default of the useLibraryCodeForTypes
from false to true to bring pylance and pyright into alignment. Also deprecated the "--lib" command-line option, which was previously used to enable useLibraryCodeForTypes
from the command line. If your project relies on the old default value, you will need to explicitly set useLibraryCodeForTypes
to false in your project’s configuration file.
Behavior Change: Changed reportImportCycles
so it is not on by default in "strict" type checking mode. It is highly opinionated and should be used only in cases where the developer opts into it.
Enhancement: Improved the synthesized __init__
method of a TypedDict
class so it accepts another instance of the same TypedDict (or another TypedDict that is type compatible) as an argument. This makes pyright compatible with mypy in this regard.
Bug Fix: Added the ability for any callable to conform to a protocol that includes attributes and methods defined in the pseudo-class builtins.function
.
Bug Fix: Fixed a bug that resulted in incorrect type evaluation when a partially-specialized generic method (with method-scoped type variables) is passed multiple times to a function that accepts generic callables.
Behavior Change: Reverted recent change that validated that explicitly-annotated self
and cls
in overloaded methods was a subtype of the class that contains them. This change made pyright consistent with mypy, but feedback from pyright users indicated that it was not desired. There are legitimate use cases for this in the overload case.
Bug Fix: Fixed bug that led to incorrect type narrowing for mapping patters in a case
statement if the type included a recursive type alias.
Bug Fix: Fixed bug that potentially resulted in internally corrupted state when a class
or def
statement appears within a conditional block that is determined by the binder to be unreachable.
Bug Fix: Fixed a bug that resulted in a false positive error when assigning a function that has one or more tuple parameters to a generic callable that also accepts tuple parameters.
Bug Fix: Fixed a bug that led to a false positive error when combining a generic callback argument with a second argument that is an empty dict expression.
Bug Fix: Fixed bug in typePrinter that caused syntactically-incorrect output when using the "PythonSyntax" flag and passing a callable type that has a ParamSpec
but no additional concatenated parameters.
Performance: Improved internal type caching mechanism used in cases where evaluation needs to be done speculatively (e.g. when evaluating argument expressions for an overloaded function). The previous code consumed significant memory and CPU cycles in certain circumstances.