pyright

Static Type Checker for Python

OTHER License

Downloads
2.3M
Stars
13.2K
Committers
119

Bot releases are hidden (Show)

pyright - Published 1.1.240

Published by erictraut over 2 years ago

Enhancement: Enhanced reportIncompatibleMethodOverride check to detect cases where a staticmethod, classmethod or instance method override a method that doesn't match in that regard.

Bug Fix: Added check for complex code blocks (that contain hundreds of if/elif statements within loops). These now emit an error rather than resulting in tens of seconds of compute.

Bug Fix: Fixed bug that resulted in combinatoric explosion within a union when using literals in an augmented assignment. This led to crashes in extreme cases.

Bug Fix: Added limit to the number of recursive function return type inference operations that can be pending concurrently. Theoretically, this could be arbitrarily deep, which will eventually overflow the call stack and crash. Such a crash is showing up in the pylance telemetry. We now limit it to 16 levels deep to prevent this crash.

Bug Fix: Fixed a bug that resulted in the incorrect type evaluation for a member expression when the LHS type was a Type[T] type.

Bug Fix: Fixed bug that caused a crash when the setter for a descriptor class had only two parameters and was used in a class variable for another class.

Performance: Implemented small perf improvements to core union functions, which are hot paths in the type analyzer.

Bug Fix: Fixed a bug that resulted in false negative errors during protocol matching when a method within the protocol contained a keyword-only parameter annotated with a class-scoped TypeVar.

Bug Fix: Fixed bug in type evaluator that resulted in an errant Unknown type when evaluating a dependent variable assigned through a tuple within a loop.

Bug Fix: Fixed bug in code flow engine that results in infinite recursion and a stack overflow under certain circumstances.

Bug Fix: Fixed bug that resulted in inconsistent behavior when a TypeVar was used as the value for a magic method and was explicitly or implicitly set to Any or Unknown.

Bug Fix: Fixed a false positive error related to __slots__ usage within a dataclass.

Bug Fix: Fixed bug in static expression evaluator that resulted in incorrect evaluation when using the not unary operator.

Bug Fix: Improved type evaluation for expressions that are determined to be unreachable. Such code should evaluate to the type Never and never generate errors or warnings.

pyright - Published 1.1.239

Published by erictraut over 2 years ago

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug that resulted in an infinite loop when a reference to a generic function was passed to itself as an argument.

pyright - Published 1.1.238

Published by erictraut over 2 years ago

Bug Fix: Fixed a bug that generated a false positive when importing from a "py.typed" namespace package. This change also loosens the requirements for a "py.typed" file to be in each of the submodules within a namespace package; a single "py.typed" within the top-level namespace directory is also now supported.

Enhancement: Improved error message for protocol mismatch due to invariance of mutable attributes.

Bug Fix: Fixed bug in type evaluation of a generic type alias that refers to a generic Callable and is missing explicit type arguments. The type argument should implicitly be Unknown in this case.

Enhancement (contribution from Robert Craigie): Add support for showing key on hover for unions of TypedDicts.

Bug Fix: Fixed recent regression that broke the --watch mode of the cli version of pyright.

Bug Fix: Fixed an infinite recursion crash that occurs within the code flow engine in rare circumstances.

Bug Fix: Fixed bug that resulted in a false positive error when assigning certain value types to a property's setter.

Bug Fix: Fixed a bug that resulted in a false negative when solving for a ParamSpec. The type analyzer wasn't generating an error when multiple assignments to a ParamSpec were incompatible.

Bug Fix: Fixed bug in constraint solver logic that resulted in a crash in certain edge cases.

Bug FIx: Fixed bug that resulted in incorrect type evaluation in cases where a decorator returned a generic Callable[[U], U] and this decorator was applied to a function with one or more parameters that were typed with a union that included a "raw" type variable, such as func(x: T | list[T]).

pyright - Published 1.1.237

Published by erictraut over 2 years ago

Bug Fix: Fixed recent regression that results in a false positive when evaluating *P.args and **P.kwargs argument types passed to a function within a nested inner function.

Bug Fix: Fixed bug that resulted in false positive with the reportOverlappingOverload diagnostic check when a parameter in one overload is annotated with type or Type[Any] and the corresponding parameter in another overload is annotated with Any.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when an import statement failed to resolve and targeted a submodule of a previous import statement, such as import a.b followed by import a.b.c where a.b.c couldn't be resolved. In this circumstance, pyright "forgot" that a.b had been resolved previously, so all symbols imported from a.b were evaluated as Unknown.

Enhancement: Enhanced reportUnnecessaryComparison diagnostic check so it also detects cases where a function appears within a condition expression. This is a common source of programming error.

Bug Fix: Fixed bug that resulted in a false positive error when validating the variance of a type variable used within a protocol class. It specifically affected the case where a TypeVar was used in the return type of a read-only property.

Bug Fix: Fixed a bug that resulted in a false negative when validating arguments to a function that uses a specialized TypeVar within an unpacked tuple as an *args parameter type.

Enhancement: Expanded the reportUnknownVariableType check to cover some cases that it didn't previously. It now handles unknown or partially-unknown symbols imported from from a import b statements, unpacked assignments, with a as b statements, and more.

Bug Fix: Fixed a bug that resulted in a runtime assertion (and crash) when dealing with return expressions that involve more than one constrained TypeVar.

pyright - Published 1.1.236

Published by erictraut over 2 years ago

Performance: Improved performance of code flow analysis.

Bug Fix: Fixed inconsistency in type printer when outputting a callable with an Optional return type.

Bug Fix: Fixed bug that resulted in incorrect "unreachable code" when a match statement contained a guard expression that statically evaluates to True.

Bug Fix: Fixed a bug that caused a false negative with the reportMissingTypeArgument check when used with a member access expression where the LHS is a module.

Bug Fix: Fixed false negative when a class variable of type type[T] is specialized to type[Any] and then assigned a value in a base class that is not compatible with type[Any].

Bug Fix: Fixed a type evaluation bug that occurs when a constructor uses a class-scoped ParamSpec and uses *args: P.args and **kwargs: P.kwargs parameters.

Bug Fix: Added exception handling to recover from errors thrown by the YarnFS (zip handling library).

Bug Fix: Fixed regression that resulted in an incorrect Unknown type evaluation for a variable within a loop.

Bug Fix: Fixed a recent regression that resulted in incorrect type evaluation within a loop with dependency chains between variables.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed a bug related to specialization of a generic class that uses ParamSpec when the type argument corresponding to the ParamSpec is unspecified. In this case, the ParamSpec should receive a "default" signature (*args: Any, **kwargs: Any) — the ParamSpec equivalent of Any.

Bug Fix: Fixed a bug that resulted in a false negative in the type consistency checks for functions with a ParamSpec.

Bug Fix: Fixed a bug that resulted in a false negative when calling a function that includes a ParamSpec from within an inner function. The code was not verifying that *args and **kwargs with the appropriate ParamSpec type were passed as arguments.

Bug Fix: Fixed bug that resulted in a false negative when dealing with a mutable instance or class variable in a Protocol class. Such variables need to be treated as invariant when performing protocol compatibility checks.

pyright - Published 1.1.235

Published by erictraut over 2 years ago

Performance: Fixed a performance regression that manifested when analyzing a large dictionary literal statement with a declared type.

Enhancement: (Contributed by Robert Craigie) Show TypedDict key type and docstring on hover.

Behavior Change: Updated logic for dataclass_transform to handle recent clarification in PEP 681 for cases where one or more overloads are decorated with dataclass_transform.

Enhancement: (Contributed by Kevin Coffey) Added support for type guard based on a.b is None or a.b is not None patterns where b is a member variable that distinguishes two different classes.

Enhancement: (Contributed by Robert Craigie) Add support for going to definition for TypedDict keys.

Behavior Change: Changed hover provider to display (property) rather than (method) if the field is decorated with a descriptor object.

Enhancement: Changed logic for hover and completion providers to support docstrings for general descriptors rather than just properties.

Enhancement: Made synthesized get method in TypedDict classes a bit smarter. If a field is required, the default parameter's argument (or None if no default argument is provided) is ignored because the type will always come from the required field. If the TypedDict class is marked @final, any literal key name that is not part of the class will always return the type of the default argument (or None if no default argument is provided).

Bug Fix: Fixed bug that could theoretically account for some of the remaining stack overflows that we're seeing in the pylance telemetry.

Bug Fix: Fixed bug in the package type verifier where it incorrectly flagged an assignment to a descriptor member within a child class as an ambiguous override of that member.

Bug Fix: Changed the way pyright detects high memory usage and decides to empty its internal type cache.

Performance: Added perf enhancement to improve analysis times for complex unannotated code. Lowered complexity threshold for call-site return type inference and skipped argument expression evaluation for call expression when base call expression type is unknown.

Performance: More performance optimizations for complex unannotated functions. Don't evaluate argument or subscript expressions if base type of call expression or index expression is incomplete.

Enhancement: Updated typeshed stubs to latest.

pyright - Published 1.1.234

Published by erictraut over 2 years ago

Performance: Fixed bug that resulted in long analysis times when using call-site type inference for very complex functions that have no parameter annotations.

Behavior Change: Removed support for transform_descriptor_types parameter in dataclass_transform, a feature that was determined to be not necessary. Added support on normal dataclass handling for field types that are custom descriptor objects.

Bug Fix: Fixed bug in logic that determines whether to empty the in-memory type cache if it has the potential to overflow the heap.

Enhancement: Improved printing of string nodes in error and log messages. If the string node is long, it is truncated to 32 characters.

Enhancement: Improved textual form of string literal types. If the string literal is very long (>50 characters), it is truncated.

Bug Fix: Fixed recent regression that caused the "--verifytypes" feature to incorrectly report that the "self" parameter of a @property method as unannotated.

Performance: Removed older mechanism for tracking "incomplete types" — those that have been partially evaluated within a code flow loop. The older mechanism is no longer needed. Removing this is a big performance win in some (typically more complex) pieces of code.

Performance: Fixed performance issue that caused long analysis times in some complex unannotated functions when attempting to infer whether the function was a NoReturn return type.

Performance: Improved performance of code flow "reachability" analysis.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed false positive error in "unreachable exception" detection code when the exception was typed as Type[Exception].

Enhancement: Contributed by Kevin Coffey - Extended a[I] is None type narrowing logic to handle subtypes of Tuple including NamedTuple.

pyright - Published 1.1.233

Published by erictraut over 2 years ago

Behavior Change: When hovering over the LHS of an augmented assignment (e.g. the a within a += x), reveal the type of the symbol after the operation rather than before.

Enhancement: Updated the reportUnusedExpression check to also report diagnostics for a simple name expression as a standalone statement.

Bug Fix (from pylance): Fixed several bugs related to "Rename Symbol" command and improved performance in some cases.

Bug Fix: Fixed crashing bug due to stack overflow when traversing the code flow graph.

Behavior Change: Modified algorithm for calculating the complexity of a function's code flow. If the complexity exceeds a certain threshold, pyright will not attempt to analyze the code.

Bug Fix: Fixed a bug that resulted in incorrect import resolution when the import referenced an empty directory within the stubspath. It should continue searching for imports in other locations in this case.

Bug Fix: Fixed regression that caused false positive error when protocol match involved a property that returned a type that was generic.

Bug Fix: Fixed bug that resulted in a false negative when assigning an invariant type var was specialized with a protocol type.

Bug Fix: Fixed several bugs relating to type evaluation within loops. This is a significant change to the code flow engine logic.

pyright - Published 1.1.232

Published by erictraut over 2 years ago

Enhancement: Improved diagnostic messages for overload implementation mismatch.

Bug Fix: Fixed bug that resulted in false negative when assigning one function to another and the dest contains named positional arguments that have no corresponding positional slot in the dest and the dest does not contain a **kwargs.

Bug Fix: Modified the special-case logic for property so it exposes methods and attributes provided by object.

Bug Fix: Improved the reportIncompatibleMethodOverride check to report a diagnostic if the base method provides a default argument value for a parameter but the override does not.

Behavior Change: Lowered cyclical code complexity threshold for code flow analysis in an attempt to reduce stack overflow crashes.

Bug Fix: Fixed a false positive error relating to __slots__ when using a descriptor object that was assigned to a class variable in a base class.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support for new assert_type call, which is being added to Python 3.11 and typing_extensions.

Bug Fix: Fixed false positive error that occurs when assigning a class variable with a type annotation an expression that involves the name of the class variable symbol.

Bug Fix: Improved modeling of property class so its fget, fset, fdel, __get__, __set__ and __delete__ methods are updated properly when adding a setter or deleter.

Bug Fix: Fixed bug that resulted in false positive when overriding a method with position-only parameters when the base uses the old-style mechanism and the override uses the new-style / separator or vice versa.

pyright - Published 1.1.231

Published by erictraut over 2 years ago

Behavior Change: Moved a couple of type-related diagnostics under the reportGeneralTypeIssues diagnostic rule rather than reporting them unconditionally.

Bug Fix: Fixed false negative for the reportIncompatibleMethodOverride diagnostic check. It was not detecting the case where the base method used keyword parameters but the override method used position-only parameters.

Bug Fix: Fixed bug that resulted in a false positive error when matching a module against a specialized generic protocol class.

Bug Fix: Fixed a bug that resulted in misleading output when printing the type of a generic alias that includes a generic function parameterized by a ParamSpec and is later specialized.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when a generic type alias parameterized with a ParamSpec was specialized multiple times.

Bug Fix: Fixed bug in "--verifytypes" feature. It was ignoring a missing parameter annotation for the first parameter in a non-method function.

Bug Fix: Fixed a bug that resulted in a false positive error when a generic callback protocol was passed as an argument to another generic callback protocol.

pyright - Published 1.1.230

Published by erictraut over 2 years ago

Bug Fix: Fixed a bug that resulted in a false positive "reportMissingParameterType" error when using an old-style double underscore parameter name to indicate position-only parameter.

Bug Fix: Handled the special case where an Any expression is bound to a ParamSpec giving it default parameters.

Bug Fix: Fixed bug that resulted in a false positive error when using a dictionary unpack operator ** with an instance of a class that satisfied the SupportsKeysAndGetItem protocol but did not directly derive from Mapping.

Enhancement: Added new diagnostic check reportUnusedExpression to catch bugs like a == 4 when a = 4 was intended.

Enhancement: Added special-case logic for a Type[T] (where T is an unbound TypeVar) that is instantiated through a call to its constructor. It should evaluate to T rather than Any.

Bug Fix: Fixed bug in pattern exhaustive match logic that failed to detect exhaustive match when the subject expression was a unnarrowable expression form.

Bug Fix: Improved the heuristics in the alias resolution logic to prefer declarations that are in non-exception paths even if the exception path has a typed decl and the non-exception decl must be inferred.

Bug Fix: Fixed two bugs that generated false positive errors when using PEP 604 union syntax in an implicit type alias. The first bug affected the case where the union started with None. The second affected the case where a TypeVar was included in the union.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug that resulted in false positive reportIncompatibleVariableOverride error when one base class defined a symbol as a property and another base class defined a symbol as Any.

Enhancement: Added support for the use of Concatenate as a type argument for a generic type alias that accepts a ParamSpec.

pyright - Published 1.1.229

Published by erictraut over 2 years ago

Bug Fix: Fixed a bug that caused semantic highlighting to sometimes skip information for certain tokens involved in member access expressions.

Enhancement: Added checks for incompatible variable types for same-named instance or class variables in two base classes.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that led to misleading type error messages and hover text when a type with an associated generic type alias was specialized. The underlying generic type was properly specialized, but the type alias itself appeared to be unspecialized still. Since the type alias is displayed in error messages and hover text, this was confusing.

Bug Fix: Fixed a bug where classes that derive from Any are not allowed to be assigned to a TypeVar. This resulted in a false positive error when returning NotImplemented in a function that is annotated to return a TypeVar.

Bug Fix: Fixed a bug that resulted in a false positive error "variable not in slots" when a value was assigned to a class variable that is a descriptor.

Bug Fix: Fixed a bug in the __post_init__ validation logic that resulted in a false positive when a dataclass with an InitVar derives from another dataclass with an InitVar.

Enhancement: Added support for per-line suppression of diagnostics using # pyright: ignore comment. This also supports rule-specific suppression using a list of diagnostic rules, as in # pyright: ignore [reportGeneralTypeIssues].

Bug Fix: Fixed a bug in the reportUnnecessaryComparison diagnostic rule that resulted in false negatives when one of the two operands included a None in the type.

Bug Fix: Fixed a bug that resulted in a false positive error when testing type compatibility of an invariant type argument that consists of a union of types, some of which are subtypes of each other.

pyright - Published 1.1.228

Published by erictraut over 2 years ago

Bug Fix: Improved "reportUnnecessaryComparison" diagnostic check so it catches more cases.

Performance: Fixed performance bug that was causing a significant slowdown when evaluating highly nested call expressions especially when there are argument errors in the innermost expressions.

Enhancement: Extended support for narrowing of index expressions to include those with negative subscripts, such as a[-1]. This is supported for all supported type guard patterns.

Bug Fix: Fixed bug that resulted in a false positive error when using typing.Self in an inner function defined within an outer method.

Enhancement: Added negative type narrowing support for sequence patterns in match statements.

Bug Fix: Fixed a bug in negative type narrowing for class patterns in match statements when the class in the class pattern is one of the designated "special built-in classes" specified in PEP 634 and a class argument is specified.

Bug Fix: Fixed a bug that resulted in incorrect TypeVar resolution when the TypeVar was used in a Type[T] type expression, was constrained, and two of the constraints overlapped in type.

Bug Fix: Fixed an edge case in the code flow engine that theoretically could result in incorrect type evaluation.

Bug Fix: Fixed a bug in the code flow engine that resulted in inconsistent type evaluation depending on order of evaluation in some cases where a variable is modified in a loop.

Bug Fix: Fixed bug that resulted in a stack overflow when evaluating unions with large numbers of subtypes.

pyright - Published 1.1.227

Published by erictraut over 2 years ago

Enhancement: Extended conditional types to function and constructor calls where one or more arguments is a conditional type.

Bug Fix: Fixed a bug that resulted in incorrect type inference when assigning () to a variable with an explicit type declaration of tuple[()].

Bug Fix: Fixed bug that results in incorrect type evaluation when an if statement is not paired with an else and the condition expression uses a not paired with an and or or.

Bug Fix: Fixed bug that caused a class that derives from NamedTuple to not conform to the Hashable protocol.

Behavior Change: Changed override detection to always use an overload implementation if present.

Behavior Change: Fixed bug that caused symbols in unreachable code to be ignored in "Rename Symbol" and "Find all References" operations.

Bug Fix: Fixed bug that resulted in a false positive when cls was used as an argument to a dynamic type creation call.

Enhancement: Improved error message for overload that doesn't match its implementation.

Bug Fix: Added code to avoid an attempt to analyze a function if its code flow complexity is too high. This reduces the likelihood of a stack overflow within the type evaluator. If a function or module is too complex, a diagnostic is now emitted to tell the developer that full analysis is suspended for that execution scope.

Bug Fix: Improved reportIncompatibleMethodOverride diagnostic check, including fixes for a few false positives and false negatives and improvements to diagnostic messages.

pyright - Published 1.1.226

Published by erictraut over 2 years ago

Bug Fix: Improved parser to detect extremely deep chains of call expressions that can crash the type evaluator.

Bug Fix: Fixed bug that resulted in false positive error when detecting overlapping method overloads when the overloads use a class-scoped TypeVar.

Bug Fix: Fixed a bug that resulted in a false positive error when validating type compatibility between two functions with nested Concatenate and ParamSpec usage.

Bug Fix: Fixed a bug in the code flow graph relating to "with" statements that are nested within a "try" statement when the context manager does not swallow exceptions but instead forwards them to the outer except clause.

Enhancement: Improved error message for binary and unary operations when an expected type (bidirectional inference) is present.

Bug Fix: Fixed a performance issue that caused long analysis times for some code flow graphs that involve deeply nested loops and many interdependent variables.

Bug Fix: Fixed a bug that resulted in a false positive error when assigning a value of type type | Any to type type[T].

Bug Fix: Fixed a bug that resulted in false positive errors when assigning a value to class variable that contains a generic descriptor object.

Enhancement: Improved the error message for a call expression where a keyword argument and a positional argument target the same parameter.

Enhancement: Updated typeshed stubs to the latest version.

pyright - Published 1.1.225

Published by erictraut over 2 years ago

Bug Fix: Added missing checks for an attempt to modify a variable that has been marked "Final" using a means other than a simple assignment statement. This includes augmented assignments, tuple assignments, for statements, with statements, assignment expressions, etc.

Behavior Change: Modified parameter type inference logic to not infer a parameter's type based on the default argument value if the value is a tuple, list, set or dict.

Enhancement: Improved type evaluation of type(x) to handle the case where x is a union type.

Bug Fix: Fixed bug that caused false negative when a class defined a __getattr__ method but no __getitem__ method and a subscript expression was used with a class instance.

Bug Fix: Fixed a bug in the logic that determines whether a class that derives from a protocol implements all of the functions and variables within that protocol. It wasn't considering mix-in classes.

Bug Fix: Fixed regression in "finally" type analysis that allowed type violation errors to go unreported in finally clauses.

Behavior Change: Changed the behavior of type evaluator when it encounters an unannotated symbol within a "py.typed" source file. Previously, it did not fall back on type inference and instead evaluated the type as "Unknown". It now falls back on type inference but internally marks the type as "ambiguous". Added logic to detect "likely ambiguous inferences".

Behavior Change: Updated package type verifier to differentiate between "unknown" and "ambiguous" types.

Bug Fix: Fixed a bug in type evaluator that resulted in a crash when a function signature contains a "**" parameter with no name.

Bug Fix: Fixed a bug that resulted in a crash due to infinite recursion.

Bug Fix: Enhanced parser to detect extremely deep parse trees created from index or member access expressions. The parser now emits an error rather than allowing the type evaluator to crash (with a stack overflow) in such situations.

Enhancement: Updated typeshed stubs to the latest.

pyright - Published 1.1.224

Published by erictraut over 2 years ago

Bug Fix: Improved NoReturn return call inference when the callable type evaluates to a partial Any or Unknown.

Bug Fix: Improved heuristics related to NoReturn detection when dealing with certain libraries that attempt to import another package within a try statement but provide a "dummy implementation" in an except clause. In this situation, we should use the declaration within the try block and ignore the one in the except clause.

Bug Fix: Fixed buggy assert in type evaluator that resulted in some crashes.

Behavior Change: Changed strictParameterNoneValue to default to true rather than false. This reflects the updated guidance in PEP 484, which indicates that type checkers should not assume that a default argument of None should imply an Optional type.

Enhancement: If CLI version of pyright is run without providing arguments to certain commands, a failure is detected and reported. Thanks to Martin Fischer for this contribution.

Bug Fix: Fixed performance regression due to a recent change in the code flow engine when attempting to evaluate whether call is a NoReturn.

Enhancement: Added support for parameter type inference based on annotated base class method signatures and on default argument expressions.

Bug Fix: Fixed recent regression that caused unnecessary reanalysis when closing a file when using pyright as an LSP. The regression also sometimes resulted in unexpected errors from reanalyzed files including diagnostics about unaccessed variables.

pyright - Published 1.1.223

Published by erictraut over 2 years ago

Bug Fix: Fixed a bug in negative type narrowing logic for value patterns in match statement.

Behavior Change: Removed provisional support for PEP 677 (Alternate Call Syntax) because the proposal was rejected by the Python steering council.

Bug Fix: Fixed a bug that led to incorrect type evaluation in the "implied else" code flow path.

Bug Fix: Improved support for functions or methods that return a context manager that swallow exceptions, such as pytest.raises.

Behavior Change: Modified reportIncompatibleVariableOverride check to permit a ClassVar in the base class to be overridden by a compatible class declaration in a child class.

Bug Fix: Fixed a bug in the type evaluator that led to false positives when assigning a function type to another function type and the source contained parameters annotated with literal types and the dest contained corresponding parameters annotated with TypeVars.

Bug Fix: Fixed bug in the handling of wildcard imports. If the target module doesn't contain a dunder all definition, the resulting imported symbol list should exclude names that start with a single underscore.

Bug Fix: Fixed bug that resulted in a false positive error when using a TypeVarTuple in a classmethod.

Behavior Change: Changed heap overflow detection to use a dynamic value based on available memory rather than a hard-coded size. For the pyright VS Code extension, changed the default "max heap size" from 1.7GB to 3.0GB on 32-bit systems. On 64-bit systems, this value appears to already be a higher value (4GB), and it doesn't appear to get overridden by the lower number.

pyright - Published 1.1.222

Published by erictraut over 2 years ago

Bug Fix: Fixed bug that resulted in false positive when using a recursive type alias with a generic dataclass constructor.

Bug Fix: Fixed a bug that results in a false negative when handling a function parameter that is annotated with a function-scoped TypeVar and has a default argument value.

Behavior Change: Changed the handling of reveal_type so it participates in bidirectional type inference when used within a larger expression.

Bug Fix: Fixed long-standing bug in logic that applies config file settings for diagnostic rule severity levels. The bug caused all settings overrides to be ignored if a pyrightconfig.json file was present. The new logic applies the default values, then the settings overrides, then the pyrightconfig.json file values. The change also simplifies the code, which was getting a bit unmaintainable.

Enhancement: Extended dataclass_transform to support transform_descriptor_types parameter.

Enhancement: Added support for an unpacked TypedDict as a type annotation for a *kwargs parameter.

Bug Fix: Improved the type(x) is y type narrowing logic to handle the case where y is a TypeVar or Self type.

Bug Fix: Fixed bug in match statement type narrowing. It wasn't properly handling the negative type narrowing case for class patterns when the subject expression was a bound TypeVar or Self type.

Bug Fix: Fixed a bug related to the __eq__ method (and other order methods) that are synthesized for a dataclass. The parameter name was incorrect. It should be other.

Bug Fix: Added support for NFKC normalization of identifiers as specified in the Python lexical specification.

pyright - Published 1.1.221

Published by erictraut over 2 years ago

Behavior Change (from Pylance): Auto-exclude any folder under workspace starting with a period.

Bug Fix: Fixed a bug in type narrowing for match statement. It was not properly handling None literal patterns when narrowing in the negative case.

Bug Fix: Fixed bug that leads to a false positive error when using a class whose constructor doesn't contain any type annotations. Pyright treats such classes as though they are generic to help with inference of instance variables initialized in the constructor, but it shouldn't enforce the variance of the under-the-cover type variables.

Bug Fix: Fixed bug that resulted in a false positive when evaluating certain list comprehensions where the subexpressions had interdependencies.

Bug Fix: Fixed bug that resulted in a false positive error when evaluating type compatibility between two callables that included an *args parameter plus a set of keyword-only parameters.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support for PEP 675 (arbitrary literal strings).

Bug Fix: Added support for multiple unpack operators in a tuple list without parentheses when used in the RHS of a for statement. This was a grammar change introduced in Python 3.9.

Enhancement: Improved completions for class member access when the member variable in a child class is unannotated but a parent class provides an annotation. In this case, we should use the type information from the annotated symbol.

Behavior Change: Changed the behavior of the package type verifier so it does not flag unannotated class or instance variables if a parent class provides a type annotation for a variable of the same name. The type is inherited in this case. Also updated the library guidance to reflect this change.

Bug Fix: Fixed bug that resulted in an incorrect type evaluation when handling a namedtuple call with a second parameter that is dynamic (not statically known).

Enhancement: Improved support for namedtuple when the second argument is a tuple of string literals. It's more common to pass a list of string literals, but tuples should work as well.

Bug Fix: Reverted a recent bug fix that caused significant performance degradations and crashes under some circumstances.

Enhancement: Added special-case check for new callable syntax used within a quoted annotation passed as a bound or constraint argument to a TypeVar constructor.

Bug Fix: Improved symbol resolution of module imports within the code flow engine when determining whether a context manager swallows exceptions or a callable returns NoReturn.

Performance: Mitigated performance issue that results when doing a type compatibility check between two distinct recursive type aliases.

Bug Fix: Fixed incorrect type evaluation when evaluating a constructor call with bidirectional type inference when the expected type is generic.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when a generic class with constrained type parameters was explicitly specialized with a subclass of one of the constrained types.