npm pyright 1.1.361
Published 1.1.361

latest releases: 1.1.363, 1.1.362
15 days ago

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 item and keys attributes 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 yield statement 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 a TypedDict imported from typing_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 is Any or Unknown.
  • Fixed a false negative that occurs when reassigning a Final variable 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] where Foo is 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: Any parameter signature. Previously, this was swapped, but the new way is more faithful to the runtime.
  • Changed TypeIs to use the same logic as isinstance type narrowing logic for consistency.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.