Bug Fixes:
- Fixed bug that results in a false positive when accessing a generic attribute from an object whose type is
type[X]. - Fixed bug that results in incorrect type narrowing of a variable that is shadowed in an inner-scoped comprehension.
- Fixed bug that results in a false positive error when referencing a class-scoped type alias defined as a callable.
- Fixed bug that causes bidirectional type inference not to be used in cases where a ternary expression is assigned to an annotated instance or class variable and the ternary condition narrows the type of
selforcls. - Fixed bug that results in a spurious "type already specialized" error when using a class-scoped type alias defined using a
typestatement orTypeAliasTypeconstructor. - Fixed a bug that leads to a hang when a generic type alias definition refers to itself.
- Fixed a bug that results in missing diagnostic details under certain circumstances where bidirectional type inference is attempted in the assignment of an attribute.
- Fixed a bug that results in a false positive error when calling a function with an unpacked TypedDict with
extra_itemswhen additional keyword args are passed. - [From pylance] Fixed regression introduced in 1.1.399 that caused pyright CLI to fail to run on Linux systems.
Enhancements:
- Extended "type(x) is C" type narrowing logic to support cases where
Cis a union of types or a type variable with a union upper bound. - Added support for PEP 765, which makes it a syntax error (or warning) in Python 3.14 if a
return,breakorcontinueis used to exit afinallyclause. - Added check for named tuple field names that begin with an underscore. These result in a runtime exception.
Behavior Change:
- Reverted a recent change that extended the
reportPrivateImportUsagecheck to enforce imports from submodules whose names begin with an underscore. This change was disruptive to users of the popularpandaslibrary because it exports a submodule named_typing. This was originally intended to be experimental or private, but it was never fully addressed. The pandas maintainers will work to fix this issue (pandas-dev/pandas#55231) over the next year. I'm going to back out this change to pyright in the meantime.