github microsoft/pyright 1.1.395
Published 1.1.395

19 hours ago

Bug Fixes:

  • Fixed a bug that results in noncompliance with the typing spec when a __new__ method has an explicit Any return type annotation. In this case, type checkers should assume that the return type of __new__ is not a subtype of the containing class and should therefore ignore the __init__ method.
  • Fixed bug that results in a spurious "overlapping overload" error if the second both overloads have an *args but the first has one or more additional positional parameters
  • Fixed bug that leads to inconsistent behavior in certain cases involving the evaluation of a call whose target signature involves a parameter with a default argument value, notably where the type of the default value isn't assignable to the declared type of its parameter.
  • Fixed a bug that results in a spurious reportUnknownArgumentType error under certain circumstances.
  • Fixed a bug that resulted in a spurious error under certain specific conditions involving a call to a function or method that doesn't have a return type and whose inferred return type is based on variables calculated in a loop.
  • Fixed a bug that results in an incorrect error when determining assignability of a function with an *args that is unpacked using a *tuple[].
  • Fixed bug that results in a spurious error when an isinstance or issubclass type guard results in a narrowed type that is synthesized as a subclass of type and some other class.
  • Fixed a bug that results in a spurious error when an unpacked iterable argument expression supplies the objects for an *args parameter that is annotated with an unpacked TypeVarTuple.

Behavior Changes:

  • Exempted __init__ from override checks even in the case when the override is an object (such as a context manager) rather than a function.
  • Added special-case logic to permit type[T] to be treated as assignable to TypeForm[T] in accordance with the latest draft of PEP 747.
  • Changed the interpretation of an async function with an empty body (no yield statement) in a stub file or protocol definition that has a return type annotation of AsyncGenerator. Previously, this was assumed to be a generator even though a yield statement wasn't present. It is now assumed to be a Coroutine. This behavior is not spelled out in the typing spec, but pyright's new behavior is now consistent with mypy's.

Enhancements:

  • Improved error reporting for PEP 728 features when enableExperimentalFeatures is not true.
  • Added error check for member access expressions that attempt to bind an instance or class method to an object or class when the method accepts no "self" or "cls" parameter.
  • Added check for invalid creation of TypeAliasType outside of a class or module scope.
  • Updated typeshed stubs to the latest version.
  • Added special-case logic to allow Any to be defined in typing.pyi using a class statement rather than how it has traditionally been defined.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.