Published 1.1.361
Bug Fixes:
- Fixed a bug that results in a false negative when using bidirectional type inference to evaluate the type of a lambda expression if the expected type is a union of two or more callables.
- Fixed bug caused by incorrect synthesis of
itemandkeysattributes for named tuple classes. - Fixed bug that resulted in incorrect bidirectional type inference when calling a constructor for a generic class that defines no
__new__or__init__method. - Fixed bug that results in a false positive error when a
yieldstatement is used within a lambda following a function. - Fixed a bug that led to poor performance (effectively a hang) if an unannotated function is called through many (greater than 8) call expressions within a loop using different literal-value arguments each time.
- Fixed a bug that results in a false positive error when using
__extra_items__(PEP 728) with aTypedDictimported fromtyping_extensions. - Fixed a bug that leads to an infinite loop when performing protocol matching under certain circumstances that involve recursive protocol definitions.
- Fixed a bug that results in a false positive error when
Callable()is used as a class pattern and the subject type isAnyorUnknown. - Fixed a false negative that occurs when reassigning a
Finalvariable within a class body. - Changed the tokenizer so it is bug-for-bug compatible with the CPython tokenizer in versions 3.10 and newer in the case where a backslash (continuation character) is located by itself on a line.
- Fixed a bug that results in incorrect type evaluation when a global (module-scoped) variable is captured within an inner scope and the variable is not modified anywhere below the inner scope. It's possible in this case for the variable to be modified by code outside of the module.
- Fixed bug that resulted in incorrect evaluation of an identifier used in a method parameter type annotation if it shadows a forward reference in a class scope when the method is using PEP 695 type parameters.
- Fixed a bug that results in a false negative when an Unpack is used in a union. This isn't allowed.
- Fixed bug that produces incorrect output when converting to a textual representation the type
type[Foo]whereFoois a type alias.
Behavior Changes:
- Changed logic that synthesizes the constructor methods for a NamedTuple subclass (using the class syntax) so the
__new__method contains parameters based on field names and the__init__method contains a general*args: Any, **kwargs: Anyparameter signature. Previously, this was swapped, but the new way is more faithful to the runtime. - Changed
TypeIsto use the same logic asisinstancetype narrowing logic for consistency.