github microsoft/pyright 1.1.382
Published 1.1.382

11 hours ago

Bug Fixes:

  • Fixed bug that can result in incorrect type evaluation behaviors if a call to type is used within a loop.
  • Fixed bug that results in incorrect type inference for list, set, dict, and tuple expressions that include modules in them.
  • Fixed bug that results in false positive error when using a Final variable in a protocol and a NamedTuple or frozen dataclass as a concrete class.
  • Fixed bug that results in a false negative when assigning a value to a union type that includes the same type variable multiple times in at least one invariant context. This change eliminates the concept of a "locked" constraint tracker, which is no longer needed and was the underlying cause of the bug.
  • Fixed bug that resulted in a "reportIncompatibleMethodOverride" error being reported in the wrong location when a property method has a decorator applied to it.
  • Fixed a bug that results in a false positive when assigning Never to a type variable in a contravariant context.
  • Added check for the illegal use of TypeForm as the second argument to an isinstance or issubclass call.
  • Fixed bug that results in incorrect type narrowing when a value typed as TypeForm is used as the first argument to isinstance.
  • Fixed a bug that can result in a false positive error when a function signature contains a positional-only parameter and a keyword parameter with the same name. This can result from the application of a ParamSpec or through the use of an unpacked TypedDict.
  • Fixed a bug that results in incorrect type evaluation behaviors when a class has a custom metaclass with a __call__ method and a __new__ or __init__ method that provides a different bidirectional type inference context for parameters.

Enhancements:

  • Added special-case handling for the len(t) == L type guard pattern to handle the negative narrowing case where tuple t has a minimum length of L. In this case, the narrowed type can be computed whereas previously it was left unnarrowed.
  • Improved hover text for converters in dataclass-like classes.
  • Updated typeshed stubs to the latest version.
  • Extended reportUnnecessaryComparison to cover more cases involving is and is not operators.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.