Releases: microsoft/pyright
Published 1.1.339
Bug Fixes:
- Fixed a bug that resulted in a false positive error under certain circumstances involving inferred variance, decorators and generic type aliases.
- Fixed a bug that resulted in a false positive when
Self
was used in a value expression outside of a class body. - Fixed bug that resulted in a false positive error when overriding a TypedDict field when the overridden type was
Any
or vice versa. - Fixed bug that resulted in a false negative when overriding a TypedDict field with an incompatible
Required
orNotRequired
attribute. - Fixed recent regression that resulted in a false negative when
type
ortype[Any]
was used as a type annotation for a field in a dataclass. - Fixed a bug that results in a false positive when
anext
is passed a value of typeAsyncIterator
. - Fixed recent regression that results in false positive error where
type
ortype[Any]
is not considered type compatible withCallable
. - Fixed bug that affected the case where a TypedDict class derived from two incompatible classes using multiple inheritance. The error was reported in the wrong location.
- Fixed bug that results in incorrect type evaluation when a
raise
statement is used within a context manager that swallows exceptions. - Fixed bug that led to incorrect type evaluation with unary operator when used with a type alias defined with forward references.
- Fixed bug that resulted in a crash within the function return type checking logic.
- Fixed bug that resulted in incorrect type evaluation when
del
statement is applied to a class member implemented with a descriptor. - Fixed regression that resulted in a false negative for the
reportUnknownMemberType
check when the expression is a call argument and the member is a function with a partially-unknown signature. - Fixed a bug that resulted in incorrect type evaluation in certain cases involving generic protocols and bound TypeVars.
- Fixed a bug in the code flow engine that resulted in a false negative for a variable whose type is narrowed within an inner loop.
- Fixed bug that led to improper type narrowing for class patterns when
Callable
is used. - Fixed bug that resulted in incorrect narrowed type evaluation in certain circumstances involving certain code flow graph structures.
Enhancements:
- Added support in
dataclass_transform
for custom field specifiers that have default arguments for theirinit
orkw_only
parameters. - Implemented check for inconsistent use of
@staticmethod
and@classmethod
in overloads. - Added support for accessing members of a
TypeAliasType
object. - Added an error check for a PEP 695
type
statement within a function body. Type alias definitions are not allowed within this scope. - Added support for
*args: *Ts
parameter that captures a callable with an indeterminate number of positional parameters because some of them have default arguments. - (Contribution from @jbarrachinab) Improved a few error messages in the Spanish localization.
- Enhanced support for TypeVarTuple capture of a callable to support literal arguments.
- Added a few optimizations that help improve perf somewhat when large unions are involved.
- Added support for doc strings when using the PEP 695
type
statement.
Behavior Changes:
- Added a new typeCheckingMode called "standard". It's a subset of "strict" but a superset of "basic". It is the new default mode, and it should cover all of the required checks for conformance with the Python typing standard.
- Changed behavior of check for unimplemented methods in a class that explicitly derives from a protocol. If the class also explicitly derives from
abc.ABC
, it is exempted from this check. This is useful for mixin classes. - Changed behavior of
reportUnknownMemberType
(and other checks in thereportUnknown...
family) to not report a partially-unknown type if it refers to an unspecialized class. - Moved checks for Required/NotRequired and ReadOnly overrides from reportGeneralTypeIssue to reportIncompatibleVariableOverride for consistency. Added checks for Required/NotRequired and Readonly incompatibilities in the multiple inheritance case.
- Changed behavior of two-argument form of
super
when it is used outside of an attribute access expression. It now employs a heuristic whereby it evaluates to the next base class of the bound type. - Changed the type printer logic to avoid emitting truncated
Literal
string and bytes values when it is asked to enforce Python syntax. This mode is used for inlay hints and the stub generator (for inferred return type comments).
Published 1.1.338
Bug Fixes:
- Fixed a bug that results in a false positive error in the
reportUnknownMemberType
check whenabc.Callable
(without any type arguments) is used in the second argument to anisinstance
call. - Fixed bug in literal pattern matching that resulted in incorrect narrowing when the subject was typed with a constrained TypeVar.
- Fixed bug that led to incorrect conversion from a class constructor to a function when it involves a
__new__
method that returnsSelf
. - Fixed bug that resulted in crash under certain obscure circumstances where a class with multiple type parameters is explicitly specialized with only a subset of required type arguments.
- Eliminated some differences between the treatment of
type
andType
. These should be treated the same under all circumstances. - Fixed recent regression that resulted in a false positive when accessing a class property from a class instance.
- Fixed a bug that can result in spurious false positive errors when using deeply-nested or recursive type definitions such as
_NestedSequence
in numpy. - Fixed bug that led to a false negative when
Never
is used as an explicit type argument for a generic class or type alias if the corresponding type parameter is a constrained TypeVar. - Fixed bug that produces a false negative when attempting to assign a method to a
Callable
type where the first parameter of the method is typed asSelf
, but the callback requires the class itself. - (from Pylance) Fixed bug that led to false positive errors related to import resolution when a partial stub is used and its directory structure doesn't match that of the library.
Enhancements:
- Improved error handling for failures when explicitly specializing a generic type alias. Improved diagnostic message for
assert_type
failures when printed types look the same when not using the full name of the type. - Added support for bidirectional type inference for chained assignment expressions.
- Updated typeshed stubs to the latest version.
- Added deprecation message for class properties, which were deprecated in Python 3.11 and are going away in Python 3.13.
- Added support for parameter type inference for lambdas whose parameters include default arguments. This is analogous to the logic used for unannotated function parameters with default arguments.
Behavior Changes:
- Changed the behavior for empty dict or list expressions. Previously, a variable initialized with
{}
or[]
was not flagged as "partially unknown" by thereportUnknownArgument
check when used as an argument to a call. This resulted in a small type hole. - Changed type evaluation logic for member access expressions for
type[Any]
where the target attribute is not explicitly declared in thetype
orobject
class. Previously, pyright emitted an error in this case.
Published 1.1.337
Bug Fixes:
- Fixed a bug that resulted in a false positive when applying a descriptor whose
__get__
method whoseowner
parameter is annotated withtype[T]
. - Fixed bug that affected the
isinstance
type narrowing logic when the pre-narrowed type is a type alias that refers to a union that includes a recursive type alias. - Fixed bug in completion provider that resulted in incorrect keyword parameter suggestions for positional-only parameters.
- Fixed bug that led to a spurious "unknown argument type" when passing an unpacked tuple in a call expression.
- Fixed regression that results in a false positive when using a value of type
type[Protocol]
as the second argument toisinstance
orissubclass
if the protocol isn't@runtime_checkable
. - Fixed regression that resulted in false positive errors when a magic method (e.g.
__lt__
or__add__
) are implemented with a callable protocol object. - Fixed a bug that resulted in a false positive error when using a walrus operator in a call expression that targets an overloaded function.
- Fixed bug that led to a hang (infinite loop) in the language server when opening a document whose URI wasn't a "file". This occurred in some language servers that used an "untitled" (or similar) URI type for new documents.
- Modified recent bug fix in
isinstance
andissubclass
type narrowing logic so it better handles type variables with bounds that are unions. - Fixed a bug that resulted in a false positive error when a higher-order generic function is passed another generic function as an argument along with another argument that dictates the type of the first argument's type variable(s). This shouldn't depend on the order in which the arguments are passed.
- Fixed a bug that resulted in a false positive error when a higher-order generic function is passed another generic function as an argument along with another argument that dictates the type of the first argument's type variable(s). This shouldn't depend on the order in which the arguments are passed.
- Fixed a recent regression that resulted in a false positive error when a parent class defines a property with a getter and a child class extends the property with a setter.
- Fixed bug that led to an incorrect type evaluation when a list comprehension expression is used with bidirectional type inference and the expected type includes a type variable.
- Fixed bug that led to a false positive error when a
__getitem__
returnsSelf
. - Fixed a bug that led to a false positive when determining the type compatibility of two TypedDict definitions whose keys were typed with unions that included two other (compatible) TypedDict definitions.
- Fixed a bug that led to incorrect type evaluation when two lists with different types were concatenated using a
+
operator in a bidirectional inference context. - Fixed a bug that results in incorrect type evaluation of an index expression when the LHS is unbound. It should produce
Unknown
rather thanNever
. - Fixed bug that resulted in a false positive under certain circumstances where a recursive type alias was used and hit an internal recursion limit.
Enhancements:
- Improved lambda inference logic to handle the case where the expected type is a callable that accepts a generic callable as a parameter.
- Added error reporting for illegal use of
TypedDict
orProtocol
within a TypeVar bound or within a type annotation. - Enhanced
reportInvalidTypeVarUsage
diagnostic message to include a recommended fix. - Added check for the use of a bare
Literal
(with no type arguments) in places where it's not allowed.
Behavior Change:
- Adjusted heuristic for
reportInvalidTypeVarUse
so it doesn't emit a warning when an unbound TypeVar is used within a subscript.
Published 1.1.336
Bug Fixes:
- Fixed bug that results in an incorrect type evaluation when
functools.partial
is used with a constructor wheretype[Self]
is passed as the first argument. - Fixed bug that resulted in a crash during type analysis.
- Fixed bug that results in false positive when indexing an enum class.
- Fixed a bug that led to a false positive error when calling the same generic function multiple times in a call expression. This bug specifically affected the case where the generic function used PEP 695 syntax.
- Fixed a bug that led to a false negative when a subclass overrides a parent class with an overloaded method in an incompatible manner.
- Fixed bug in the import resolver that allowed typeshed stubs and stub files within installed third-party libraries to take precedence over local modules.
- Fixed a bug that leads an incorrect type evaluation when binding a magic method (like
__add__
) toself
when the magic method returnsSelf
. - Fixed a bug that resulted in an incorrect type evaluation when accessing a property that returns
Self
ortype[Self]
. - Fixed bug that resulted in incorrect type evaluation of a symbol imported twice by two redundant wildcard imports.
- Fixed a bug that leads to a false positive
reportPrivateUsage
diagnostic when importing a public symbol from a "py.typed" library if that symbol is imported from a private symbol (and re-exported publicly) within the library. - Fixed a bug that led to incorrect type evaluation when an inferred method return type includes a union where the subtypes are conditioned on constraints of a constrained TypeVar that parameterizes the class. In this case, one or more of these subtypes should be eliminated when a specialized class is bound to the method.
- Add support non english works in docstring arguments.
- Fix bug in the contravariant return type check where a contravariant used in a union was not reported.
Behavior Changes:
- Changed behavior when converting a class to a callable. If the class has no
__init__
or__new__
method in its class hierarchy (other than those provided byobject
), pyright previously converted the constructor to a signature of(*args: Any, **kwargs: Any)
. It now converts it to a signature of()
(i.e. no params) unless it's atype[T]
or a protocol class. - Modified the
isinstance
type narrowing logic to retain a TypeVar when narrowing in the positive case and the value is not a constrained TypeVar.
Enhancements:
- Added "metacls" as an allowed name for the "cls" parameter in a metaclass
__new__
method. - Improved pyright's enforcement of keyword arguments passed within a
class
statement when the class has no custom metaclass or__init_subclass__
in its hierarchy. In this case, theobject.__init_subclass__
method applies, and it accepts no additional keyword arguments. Also improved the error reporting for__init_subclass__
in general. - Improved handling of
+
operator when both operands are tuples. It now produces a more accurate type when one (but not both) of the two tuples is of indeterminate length. - Updated typeshed stubs to the latest version.
- Added code to CLI to verify file specs passed on the command line. If they don't exist, emit an error and a non-zero exit code.
- Improved check for second argument to
isinstance
andissubclass
so non-runtime-checkable protocol classes are rejected. - Added special-case handling
x in y
narrowing logic for the case wherex
is adict
orMapping
andy
is an iterable ofTypedDict
s. - Added check for the use of contravariant TypeVars in an inferred return type.
Published 1.1.335
Bug Fixes:
- Fixed a bug that resulted in a false positive when validating type consistency between a metaclass instance and
type[T]
. - Fixed bug that led to an inconsistency between the use of
type
andType
when applyingisinstance
type narrowing in some cases. - Fixed recent regression in the CLI that caused the
--files
command-line parameters to be overridden by the "include" setting in the config file. - Fixed bug that led to a false positive when assigning a lambda with
*args
to a callable type that doesn't contain*args
. - Fixed a few places where union order resulted in different type evaluation behaviors.
- Fixed a bug that led to a false positive error when specializing a type alias consisting of a callable parameterized by a TypeVarTuple.
- Fixed bug that causes a false positive MRO error when creating a subclass of a generic TypedDict and another TypedDict.
- Fixed a bug that results in incorrect type evaluation of a call expression when the callee is a function parameterized by a TypeVarTuple that has been specialized with a concatenation form.
- Fixed several bugs in the signature help provider when handling
**kwargs
parameters typed with an unpacked TypeDict (PEP 692). - Added missing check described in PEP 692 where fields within an unpacked TypedDict used for
**kwargs
cannot overlap other keyword parameters in the same signature. - Fixed a false positive
reportIncompatibleMethodOverride
error under certain circumstances where an overloaded method overrides another overloaded method. - Fixed a bug that resulted in incorrect type evaluation when using a
TypeVarTuple
within a nestedCallable
type (i.e. aCallable
that takes aCallable
as a parameter). - Fixed bug that resulted in false positive reportIncompatibleMethodOverload error under certain circumstances.
- Fixed a bug that causes a false positive
reportUnnecessaryContains
error whenself
is used on the LHS of thein
operator within an enum class. - Fixed bug that led to a false negative when assigning type
Class
toSelf@Class
. - (Contribution by @JelleZijlstra) Fix missing space after "not" unary operator for expressions printed in output of
reveal_type
. - Fixed bug in completion provider that resulted in an attempt to tokenize and parse a binary (native) library file. This led to a crash in some cases.
- Fixed a bug that results in a false positive error when a
__new__
method returnsSelf
for a generic class and the type variable is invariant. - Fixed a bug that led to incorrect type narrowing for the
x is None
in the negative (else) case whenx
is a bound TypeVar (orSelf
).
Enhancements:
- Improved error message for descriptor accesses where binding or type validation fails for the
__get__
,__set__
or__delete__
methods. - Added missing error check for zero-argument form of
super()
when used within a static method. - Improved error message for member accesses.
- Improved diagnostic message for method overrides based on keyword/position-only parameter mismatch.
- Enhanced the handling of zero-argument form of
super()
to support the case where the containing method'sself
orcls
parameter is annotated using a protocol. This can be used to handle mixin methods that callsuper()
. - Added support for boolean values in diagnosticSeverityOverrides language server setting.
Other Changes:
- Updated heuristics for constructor evaluation to accommodate a wider range of types returned by the
__new__
method. Previously, if the__new__
return type was anything other than a class instance, the heuristics assumed it wasn't intended and assumed that__new__
returned an instance of its class, as is usually the case. - Restored previous behavior (prior to 1.1.334) where an instance of a class that derives from
Any
will not be considered type compatible withNone
. - Significant rewrite of code that handles member accesses on class objects and class instances. This should improve internal consistency and fix many edge-case bugs. Due to the extent of this change, some regressions may result.
Published 1.1.334
Bug Fix: Fixed a bug that caused locale override to fail to take effect if passed via the LSP initialize message.
Bug Fix: Fixed issue that led to false positive error when calling a NoReturn
function within a case
block or within an if
/elif
chain.
Enhancement (contribution by pakrym-stripe): Support unpacked TypedDict in parameter hover.
Performance: Fixed a performance regression that affected symbol type inference in the presence of circular dependencies.
Enhancement: Updated typeshed stubs to the latest version.
Bug Fix: Improved support for runtime TypeVar
, TypeVarTuple
and ParamSpec
objects, including when they are instantiated from typing_extensions
classes.
Enhancement: Improved inference logic for lambdas so it handles a wider variety of cases including lambas with *args
parameters and cases where the expected type is a union of multiple subtypes that might be matches.
Enhancement: Improved TypedDict update
method error message when no overloads match.
Bug Fix: Fixed a bug that led to a false positive when using an unpacked iterable as an argument in a call expression after a keyword argument.
Enhancement: Added support for python.analysis.include
, python.analysis.exclude
and python.analysis.ignore
settings. These have been implemented in pylance for a while now, but they were never implemented previously in pyright. Also fixed a bug in the original implementation that caused the config file not to override the language server settings for python.analysis.exclude
and python.analysis.ignore
as it should.
Bug Fix: Fixed bug that led to false negative when evaluating a call to a function with a recursive ParamSpec.
Bug Fix: Fixed a bug in the type guard logic for simple truthy/falsy checks. If the type is an instance of object
or a TypeVar
with no bound (which is treated like an object
), the logic should not assume that it will always evaluate to truthy.
Published 1.1.333
Bug Fix: Fixed a bug that resulted in a false negative when assigning one TypedDict to another TypedDict. Field types should be treated as invariant rather than covariant because they are mutable (unless marked readonly).
Enhancement: Improved the synthesized update
method for TypedDict
classes so it supports keyword arguments and iterables of tuples.
Bug Fix: Improved error message for protocol mismatch when a method in the source cannot be bound.
Performance: Added performance improvement that speeds up type checking for TypedDict classes that have a large number of entries.
Bug Fix: Fixed a bug that led to a false positive when doing protocol matching for a protocol that uses deeply nested recursion.
Bug Fix: Fixed a bug that resulted in incorrect narrowing on assignment when the assigned type is a tuple that includes one or more Any
type arguments and the declared type is a tuple without an Any
.
Bug Fix: Fixed a bug that led to a false positive error when doing protocol matching for a protocol and implementation that use a combination of class-scoped and function-scoped TypeVars.
Bug Fix: Fixed several bugs in ReadOnly
TypedDict functionality based on the latest draft of the PEP 705.
Enhancement: Extended the len(x) == L
type guard logic to support arbitrary expressions L
that evaluate to a literal int type.
Behavior Change: Removed support for readonly
keyword parameter for TypedDict
to reflect latest changes in PEP 705.
Bug Fix: Fixed bug in protocol matching when source is a namedtuple or a frozen dataclass. Algorithm wasn't taking into account that attributes in these classes are immutable.
Published 1.1.332
Bug Fix: Fixed crash that occurs when encountering a malformed system version check of the form sys.version_info[0] < 3.8
.
Enhancement: Improved error message for yield
statements when the yield type is a TypedDict or other type that requires bidirectional type inference.
Bug Fix: Fixed regression in type(x) is y
type narrowing logic when y
is of type type[Self]
.
Bug Fix: Fixed a bug in protocol matching logic that resulted in a false positive error when a class implementation used a callback protocol rather than a def
statement to define an instance variable defined in a protocol.
Bug Fix: Fixed a bug that resulted in an unresolved Unknown
type within a tuple constructed within a loop.
Bug Fix: Fixed several bugs in protocol matching that led to false positives when matching a protocol against a module.
Behavior Change: Changed type evaluation behavior for accesses to attributes on a class that derives from Any
. Previously, these were evaluated as Unknown
, but they are now evaluated as Any
.
Bug Fix: Fixed a bug in the reportIncompatibleMethodOverride
check that leads to a false negative if the base class uses a Self
type and the override uses an incompatible specialized type.
Enhancement: Added logic to detect illegal use of the symbol Any
.
Enhancement: Added logic to perform basic reformatting (especially dedenting) of deprecation messages used with @deprecated
.
Bug Fix: Fixed a bug in the isinstance type guard logic when the specified filter class (the second argument) is a metaclass (a subclass of type
).
Bug Fix: Fixed a bug in the issubclass
type narrowing logic when the first argument is a metaclass (a subclass of type
).
Enhancement: Updated typeshed stubs to the latest version.
Behavior Change: Changed override-related checks (reportIncompatibleMethodOverride
, reportIncompatibleVariableOverride
and reportImplicitOverride
) so they apply to stub files. Previously, these were skipped for stubs.
Bug Fix: Fixed a bug that caused types captured by ParamSpecs to sometimes be printed with Unknown
parameter types.
Bug Fix: Fixed a bug in ParamSpec type matching that resulted in an incorrect type evaluation under certain circumstances.
Bug Fix: Fixed a regression in overload matching that resulted in false positive errors in hydra-zen. This change involves removing a heuristic from overload matching that attempted to eliminate a false positive error for x: list[str] = "a,b".split(",")
.
Bug Fix: Fixed a bug that results in confusing error messages when converting a constructor (an __init__
method) to a function type. The resulting function should not be named __init__
but should be anonymous.
Bug Fix: Fixed a bug that led to a false positive error when a type alias created using PEP 695 syntax is used as a type argument for a generic type when used in the LHS of a call expression.
Bug Fix: Fixed a bug in the isinstance
type narrowing logic when using a generic class whose type parameters include defaults (PEP 696).
Bug Fix: Fixed a false positive error "TypeVar bound cannot be generic" if the bound type is a generic class whose type parameters have default types (using PEP 696).
Bug Fix: Fixed bug in "type printer", the code that converts a type to text for error messages. It wasn't properly handling type(t)
where t
is defined using a type alias.
Enhancement: Improved the error message for metaclass conflicts so the conflicting metaclasses are specified.
Bug Fix: Fixed a bug in the type narrowing logic for sequence patterns, specifically when the subject is Any
or Unknown
and the sequence pattern is empty ([]
).
Bug Fix: Fixed a bug with path normalization (in particular, drive letter) for symbolic links that resulted in false positive errors.
Bug Fix: Fixed a bug that led to a false positive error when attempting to instantiate a value of type type[Self]
when Self
refers to an abstract class.
Bug Fix: Fixed a bug that led to a false positive error when passing type(None)
or NoneType
as the second argument to issubclass
.
Bug Fix: Fixed a bug in the issubclass
type narrowing logic for type(None)
and NoneType
filters.
Bug Fix: Fixed a bug that led to a stack overflow crash under certain circumstances when evaluating a function call with a ParamSpec.
Bug Fix: Fixed bug that prevented ReadOnly
experimental feature from being used in a file where a # pyright: enableExperimentalFeatures=True
comment was used.
Published 1.1.331
Bug Fix: Fixed a bug that led to a false positive error and incorrect type evaluation under certain circumstances when multiple symbols depend on each other in a loop.
Bug Fix: Fixed a recent regression that led to a false positive error when a class uses a custom metaclass that supplies a __setattr__
method.
Enhancement: Improved type narrowing in the negative case for isinstance
when the filter type (the second argument) is type[T]
(where T
is a type variable) and the first argument is of type T
. In this case, we can eliminate (filter) T
in the negative case.
Bug Fix: Fixed a bug that led to a false positive error when using a zero-argument super()
call within a class declaration within a method body.
Enhancement: Added support for @deprecated when applied to property accessors and descriptor methods.
Bug Fix: Fixed a bug that led to a false positive error when doing protocol matching with a protocol class that has a method with method-scoped type variables.
Enhancement: Added missing check for the use of a subscripted Callable
within an isinstance
call.
Bug Fix: Fixed bug that led to incorrect type narrowing for isinstance
when using Callable
and the pre-narrowed type is object
.
Bug Fix: Fixed a bug that led to incorrect type evaluation in a nested set of call expressions and a lambda.
Bug Fix: Fixed a bug that led to a confusing error message when assigning a value with an incompatible type to a class variable that has no explicit type declaration.
Bug Fix: Fixed bug in x is <Literal>
and x == <Literal>
type guard logic. It was not properly handling the case where x
is Any
or Unknown
.
Bug Fix: Fixed a bug that led to incorrect type narrowing in the type(x) is T
and type(x) == T
type guards when T
is a dynamic type rather than a specific class.
Enhancement: Improved completion provider logic for __getitem__
methods with literal types. The old logic didn't properly handle generics or overloads.
Enhancement: Don't show stubPath xxx is not a valid directory
warning in logs when using config default.
Published 1.1.330
Bug Fix: Fixed a bug in the diagnostic filtering logic that caused the grayed-out "unused symbol" treatment to be suppressed when using a # pyright: ignore
comment. This comment is intended to apply only to real diagnostics (errors, warnings, infos), not hints with tags.
Bug Fix: Fixed a bug that resulted in incorrect type evaluation when accessing an attribute on a class whose metaclass defines a __getattr__
method and the target attribute is a descriptor object.
Bug Fix: Fixed a crash that can occur if a type annotation includes too many type arguments for a class.
Bug Fix: Fixed a regression that resulted in a false positive error when using float
or complex
literals or constructor calls and then accessing a member of the resulting object that is valid on that class but not on int
.
Bug Fix: Fixed a recent regression in the overload matching behavior that broke two tests in the pandas-stubs test suite.
Bug Fix: Fixed a bug that resulted in a false positive in certain circumstances where a lambda included simple math operations with integer literals. The fix requires disabling literal math within lambdas, since they are often used as callbacks that are called repeatedly in a loop.
Bug Fix: Reverted a portion of the recent changes designed to differentiate between a float
that is really a float
or a float
that can also be an int
. This resulted in false positives when inferring types using float literals.
Bug Fix: Fixed a false positive due to incorrect type narrowing logic when a del
statement targets a specific element within a list (e.g. del my_list[1]
).
Bug Fix: Fixed a crash due to an invalid assert that occurs when a class or function that uses PEP 695 syntax is unreachable.
Bug Fix: Fixed a bug that led to incorrect type evaluation and false positives when constructing a specialized generic TypedDict.
Enhancement: Updated typeshed stubs to the latest version.
Enhancement: Improved the check for whether an object is "awaitable". Rather than hard-coding checks for __await__
and __init__
methods, use the typing.Awaitable
protocol.
Bug Fix: Fixed a false positive reportInvalidStringEscapeSequence
error if a string literal is over 32K in length and the 32768'th character is a backslash.
Enhancement: Added support for PEP 692 (unpacked TypedDict for **kwargs
) when used with a ParamSpec
.
Bug Fix: Fixed a bug that led to the loss of type narrowing for a captured variable used within an inner scope if used in a comprehension expression.
Behavior Change: Changed the default Python version (the version that is assumed by pyright if it has no other context) from 3.11 to 3.12 now that 3.12 is final.
Enhancement: Improved diagnostic for the situation where overload matching fails to find any applicable overloads.
Bug Fix: Fixed a bug that resulted in incorrect type evaluation when an async function with an inferred return type is decorated with a class or function that uses a ParamSpec (such as functools.wraps
).
Bug Fix: Fixed a bug that led to a false positive error when using a single-quote form of a format string that uses a format specifier expression. This is also a bug in the Python 3.12 interpreter that is being fixed.