Enhancements:
- Added support for
@deprecation
messages for decorators that wrap a function in a callable object. The deprecated message is now propagated through the ParamSpec and the__call__
method. - Updated typeshed stubs to the latest version.
Behavior Changes:
- Moved check for invalid use of class-scoped TypeVar within a
self
annotation in__init__
. It was previously reported underreportGeneralTypeIssues
, but it's now moved toreportInvalidTypeVarUse
. This was done to help typeshed maintainers migrate away from this pattern. - Changed behavior to no longer exempt unguarded access to not-required TypedDict member within a
try
orwith
block. Previously, such errors were exempt, but this is inconsistent with other type checks in pyright which eschew the practice of using exception handling for normal code flow.
Bug Fixes:
- Fixed recent regression that affected unannotated
__call__
methods in a metaclass. This change aligns pyright's behavior to the typing spec. - Fixed recent regression that incorrectly narrowed the type of
kwargs
when used in a type guard of the formif "a" in kwargs
. - Fixed bug in protocol matching that results in a false positive when the subject object is a dataclass that contains a callable. It should be considered an instance member in this case, so it should not be bound to the class.
- Fixed a bug that results in a false positive error when bidirectional type inference is used for a dictionary comprehension when the expected type is a union.
- Redesigned the handling of PEP 695-style type parameter scoping to better match the CPython runtime implementation. This fixes multiple bugs with type parameter symbol resolution. For example, if a type parameter is quoted as a forward reference.
- Fixed bug that leads to false negative when binding an object to an overloaded method where all of the overloads have incompatible
self
parameter types. - Fixed bug that leads to incorrect metatype for a class object that is created by calling the metaclass with a two-argument form.