1.1.380
版本发布时间: 2024-09-11 05:56:17
microsoft/pyright最新发布版本:1.1.387(2024-10-30 09:17:48)
Bug Fixes:
- Fixed a recent regression that results in incorrect type evaluation when using a two-argument form of
super()
and the second argument istype[Self]
. - Fixed a recent regression that results in a false positive type error when converting certain constructors (such as for the class
defaultdict
) to a callable type. - Fixed recent regression that results in a false positive under certain specific circumstances involving higher-order functions that return generic callable types.
- Fixed a bug that results in a false positive error during protocol matching because writable class variables defined in a named tuple or a frozen dataclass were considered read-only.
- Fixed a bug that causes incorrect type narrowing of expressions used within a tuple expression in the subject expression of a
match
statement. - Fixed a bug that results in an incorrect type evaluation of a higher-order function that is passed an overloaded function.
- Fixed recent regression that results in a false positive error under very specific circumstances involving a function with a TypeVar used in both a contravariant and covariant context and combined by union with other types in the contravariant context.
- Fixed a bug that leads to a false positive "default value is specified as ..." when using
--verifytypes
and the function has a decorator applied that uses a ParamSpec. - Simplified check for unnecessary isinstance call. Removed a bunch of redundant code and fixed a number of bugs in the process.
- Fixed a bug that leads to incorrect type narrowing with
isinstance
orTypeIs
when the filter type (the second argument toisinstance
) is a subclass oftype
. - Fixed bug that results in incorrect type narrowing for the
in
(containment) operator when the filter includes class objects (instances oftype
). - Fixed a bug that results in incorrect type narrowing for the
x is ...
(ellipsis) type guard pattern. - Fixed a bug in the stub generator so it properly outputs type aliases that use the PEP 613
TypeAlias
qualifier. - Fixed bug that causes a crash in the language server under certain circumstances with partially-written code that has syntax errors.
- Fixed a bug that results in incorrect type narrowing for
TypeIs
when it is used with aCallable
type form. - Fixed several inconsistencies and bugs in the
isinstance
type narrowing code involving callables
Enhancements:
- Added performance optimization to better handle the case where a tuple expression contains thousands of entries. This is not typically found in hand-written code, but it can appear in computer-generated code.
- Added support for custom metaclasses that derive from
ABCMeta
. Classes instantiated from such metaclasses are now treated as abstract. - Updated typeshed stubs to the latest version.
Behavior Changes:
- Changed the behavior of the dictionary expansion operator (
**
) when used in an argument expression for a call and the operand is a TypedDict. It now takes into account the fact that a (non-closed) TypedDict can contain additional keys withobject
values. This new behavior is consistent with mypy. - Removed support for python-2 raise statements with comma-delimited operands.
- Changed behavior of raise evaluation logic to allow type of exception to be
Never
. - Changed behavior to allow a value with type
_AnnotatedAlias
to be used with an implicit__getitem__
call even though this type is not documented or declared in typeshed. - Changed stub generator to avoid emitting a
from __future__
import statement, which has no meaning in stub files. - Removed support for custom
callable
type guard pattern. Now that typeshed defines this with aTypeIs
, we no longer require custom logic here.
1、 vscode-pyright.vsix 5.33MB