Skip to content

Published 1.1.346

Compare
Choose a tag to compare
@github-actions github-actions released this 15 Jan 01:01
· 1013 commits to main since this release

Bug Fixes:

  • Added code to properly print a f-string expression in pyright's "expression printer". This affected stub generation if an f-string was used (e.g. in call to a decorator).
  • Fixed a bug that resulted in a false positive error when using a bound TypeVar in an except statement.
  • Fixed a bug that led to a false negative when using a non-data protocol class in a tuple within an issubclass check.
  • Fixed a bug that resulted in incorrect inference of an async generator expression if an await keyword was used in a for iterator expression.
  • Fixed a bug that resulted in an incorrect type evaluation for a sliced tuple if the end of the slice is the same as the tuple length (off-by-one error).
  • Fixed recent regression that results in a false positive error when an unpack operator is used in an Annotated type annotation.
  • Fixed false negative when a special form is assigned to a value declared as type[T] or when instantiated.
  • Added support for generic type alias specialization when the type alias includes an unpacked TypeVarTuple and the specialization list includes an unpacked unbounded tuple.
  • Fixed bug that led to incorrect protocol matching for class objects.
  • Fixed recent regression whereby a type created with NewType was no longer allowed as an argument for another NewType.
  • Fixed a bug that resulted in an incorrect implied specialization of a generic type alias that is parameterized by a TypeVarTuple. The implied type argument should be *tuple[Unknown, ...] in this case.
  • Fixed a bug in class pattern matching logic that incorrectly narrows types when using a str() class pattern and a LiteralString subject.
  • Fixed bug that caused "final method override" diagnostic to have no associated diagnostic rule.
  • Fixed a bug that resulted in incorrect variance inference for protocols (and for PEP inferred-variance TypeVars in PEP 695) when a self or cls parameter is explicitly annotated with a type that includes the type parameter.
  • Fixed a bug that resulted in a false positive when a contravariant TypeVar was used in a return type in a non-method.

Behavior Changes:

  • Changed the way pyright identifies an "unimplemented protocol method" within a stub file. It now looks at whether the method is decorated with @abstractmethod. Previously, it assumed all such methods were potentially implemented.
  • Changed error reporting for non-protocol classes that derive from a protocol but don't implement all of the unimplemented symbols in the protocol. Previously, pyright reported the error on the class declaration. Now, it reports it at instantiation time. This is more consistent with what other type checkers do.

Enhancements:

  • Updated typeshed to the latest version.
  • Added provisional support for proposed extension to typeshed's VERSION mechanism (python/typeshed#11260).
  • Added support for + unary operator in Literal int type annotations. The typing spec was recently amended to allow this.
  • Improved handling of special forms defined in the typing module so they are treated correctly when used as runtime objects.