Pyright

Latest version: v1.1.390

Safety actively analyzes 685838 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 30 of 81

1.1.222

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.

1.1.221

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.

1.1.220

Behavior Change: Changed the type narrowing logic for truthy and falsy conditions to exempt protocol classes.

Bug Fix: Fixed bug that resulted in incorrect type evaluation of an `or` binary operator when the same expression was used in the LHS and RHS and was always truthy.

Bug Fix: Fixed bug that resulted in the incorrect evaluation of a type resulting from a call to a constructor for an explicitly-specialized generic class in the case where that class implements neither a `__new__` nor an `__init__` method.

Enhancement: Improved error message for descriptor and property setters.

Bug Fix: Fixed a bug in PEP 646 unpacked tuple support where `*args` could not be annotated with `*tuple` type.

Bug Fix: Fixed a false negative in the handling of dataclasses that contain fields with default orders before fields without default values in the case where an `__init__` is already defined on the class.

Bug Fix: Fixed bug that results in false positive error when using a PEP 677 callable arrow syntax within a quoted type on Python 3.10 or older.

Bug Fix: Fixed a bug in the code that prints types to text. It was not properly handling the case where a callable contains a synthesized *args parameter with a type that isn't unpacked.

Bug Fix: Fixed false negative where type annotations beginning with "*" were not properly flagged as a syntax error.
Improved support for matching of TypeVarTuple when used with *args parameter.

Bug Fix: Added missing check for a TypeVarTuple value that is not unpacked when passed as an argument.

1.1.219

Enhancement: Updated typeshed stubs to latest version.

Bug Fix: Fixed a bug that results in a false positive error when using a `Self` return type for an `__aenter__` method.

Bug Fix: Fixed false positive error when `P.args` or `P.kwargs` parameter type annotation is wrapped in `Annotated`.

Bug Fix: Fixed bug that caused false negative when evaluating a recursive type alias involving a tuple.

Bug Fix: Fixed a bug in the bidirectional type inference logic for list, set and dictionary expressions when that affected certain cases where the expected type contained a union.

Bug Fix: Fixed bug that resulted in false negative when using a recursive type alias with dictionary, list or set expressions.

Bug Fix: Fixed bug that resulted in the inappropriate generation of an Unknown type (and therefore false positive errors in strict mode) when using bidirectional type inference with a function that accepts a generic callable parameter.

Bug Fix: Improved detection of NoReturn calls within code flow graph. In particular, the code now handles the case where the LHS of the call expression is a member access expression and the LHS of that expression is a local variable whose type needs to be inferred.

Enhancement: Added better error handling and reporting for dataclass_transform.

Bug Fix: Fixed bug that caused crash when handling bigint literal values.

Bug Fix: Added missing check for a dataclass field that is declared with a default value in a base class but then overridden with one that doesn't include a default value in a child class. At runtime, it still acts as though it has a default value, which is inherited from the base class.

Bug Fix: Fixed bug that prevented the "--verifytypes" feature from working with namespace packages.

Bug Fix: Added missing check for improper use of `Unpack` when used in some contexts.

1.1.218

Enhancement: Allow "--watch" to be used in conjunction with "--outputjson" command-line options.

Enhancement: Added support for bidirectional type inference for `yield` statements. The expected type is based on the first type argument in a `Generator` or `AsyncGenerator` return type annotation.

Enhancement: Added the ability to add new symbols to `builtins` by simply adding a type stub file named `__builtins__.pyi` locally.

Bug Fix: Fixed a bug that led to a false positive error when handling bidirectional type inference for tuple expressions when the expected type was a union that contained multiple tuple subtypes.

Bug Fix: Fixed a bug that resulted in a false negative when a list comprehension was used within a class body and referenced a class-scoped variable in a subexpression other than the first iterable. This also fixes a similar bug where a lambda was used within a class body and referenced a class-scoped variable in its return expression. These now property generate errors, reflecting the runtime behavior.

Bug Fix: Fixed a bug that resulted in incorrect type inference for positional parameters used in class patterns if the corresponding class was defined in a "py.typed" library and it defined a `__match_args__` symbol with no annotation.

Bug Fix: Fixed bug in stub generator that caused it to omit import statements with multi-part names (e.g. `import a.b.c`) even though there was a reference within the generated stub to the imported module.

Enhancement: Extended type narrowing for class pattern matching so it supports narrowing in the negative case when arguments are present and when the pattern class is generic.

Bug Fix: Fixed a bug that resulted in a false negative when a `*args` parameter was used in conjunction with a `*` keyword-only separator parameter. This generates a syntax error at runtime.

Bug Fix: Fixed a false positive error when `TypeGuard` was used without a type argument in a runtime manner (outside of a type annotation).

Bug Fix: Fixed recent regression that results in false positive errors detected in the `reportUnknownParameterType` diagnostic check when the function includes a parameter with a double underscore name indicating that it's positional-only.

Enhancement: Improved signature help and hover text for synthesized `__init__` dataclass method when a parameter uses a field descriptor with a default value.

1.1.217

Bug Fix: Fixed a bug that resulted in a false positive error when passing an `*args` argument typed as an unpacked TypeVarTuple to a function that includes an unpacked TypeVarTuple parameter.

Enhancement: Added special-case bidirectional type inference for the right operand of the "|" and "|=" operators (with an expected type based on the left operand). This supports the case where the left operand is a TypedDict and the right operand is a dict expression that conforms to the TypedDict type.

Bug Fix: Fixed a bug in the reportIncompatibleMethodOverride check that resulted in false positive errors when both the base class and child methods have overloads but the base class does not have an implementation and the child class does.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that results in false positive errors when a `ClassVar` type declaration appears within an `Annotated`.

Bug Fix: Added special-case handling of `Generic` base types to match the (undocumented) runtime behavior. Without this special-case handling, pyright reports that "a consistent method ordering cannot be found" in some cases where the runtime does not.

Bug Fix: Fixed bug that is leading to some crashes that appear in the telemetry.

Bug Fix: Added recursion detection for wildcard import lookups during code flow.

Bug Fix: Fixed a bug that caused a type alias of `Any` to be evaluated as `Unknown` if defined within a py.typed library.

Performance: Improved performance when analyzing types that involve some forms of recursive type aliases.

Enhancement: Added support for typing_extensions.Never and typing.Never type and unified the underlying handling of Never and NoReturn, which are synonyms.

Enhancement: Improved type stub generation code to emit definitions for TypeVar, TypeVarTuple, ParamSpec and NewType.

Behavior Change: Changed heuristics for matching two union types when the destination union includes a combination of concrete types and one or more type variables. This case involves some heuristics in the constraint solver because multiple solutions are possible.

Bug Fix: Fixed a bug that resulted in a false positive when assigning to a field in a dataclass that is annotated with a Callable type.

Page 30 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.