Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 31 of 81

1.1.216

Bug Fix: Fixed recent regression that resulted in a crash (stack overflow) in the code flow engine.

Bug Fix: Fixed a bug that resulted in unknown types in member access expressions to go unreported with `reportUnknownMemberType` was enabled. This occurred when the member access expression was located within a subscript of an index expression.

Performance: Changed the logic that infers a NoReturn type to avoid inferring symbol types. This was causing a bunch of extra work to be performed in complex unannotated code bases like sklearn.

Performance: Fixed performance issue in parser for deeply-nested parenthesized expressions.

Bug Fix: Fixed bug in callable type compatibility logic. It was not properly handling some edge cases where a keyword parameter in the source and destination had an incompatible type if one or both of the types were specialized.

Bug Fix: Fixed a bug that resulted in false positives when specializing a callback protocol with a TypeVarTuple when the callback protocol also contained one or more keyword parameters that were generic.

Bug Fix: Fixed a bug in the protocol invariance checking logic. It wasn't properly handling protocols that used a TypeVarTuple as a type parameter that wasn't last (right-most) in the type parameter list.

Behavior Change: Changed import resolution order to more closely match PEP 561. Typeshed stdlib type stubs are now resolved later in the import resolution process, after all local modules and modules within the python environment.

1.1.215

Bug Fix: Fixed bug that resulted in crash when extremely large integer literals are encountered.

Bug Fix: Fixed bug that caused "extraPaths" specified for individual execution environment to be combined for all execution environments if a default "extraPaths" was also specified in the same config file.

Bug Fix: Fixed handling of `NoReturn` type, which should act like `Never` in that both are considered "bottom types" and are assignable to any other type.

Enhancement: Updated typeshed stubs to the latest.

Enhancement: Added new diagnostic check "reportMatchNotExhaustive" which reports cases where a `match` statement doesn't exhaustively cover all cases.

Enhancement: Added support for unpack operator for tuples used within type arguments. Support for this new syntax will appear in Python 3.11.

Bug Fix: Added code in parser to detect obscenely deep parse subtrees containing binary and unary operations. These were sometimes leading to crashes in the binder and type evaluator. The parser now replaces them with error parse nodes and reports an error to the user.

Bug Fix: Added recursion check in type guard logic to address stack overflow issue seen in telemetry.

Bug Fix: Fixed bug that produces a false positive when attempting to assign a value of type `Type[NoneType]` to `Type[None]`. These are equivalent, so the assignment should be allowed.

Enhancement: Enhanced parser to detect and report a runtime error that occurs when using a generator expression without surrounding parens as an argument within a call expression when more than one argument or a trailing comma is present.

Bug Fix: Fixed a bug that resulted in a false positive when a member access expression targeted an attribute that was returned by a `__getattr__` method that returns a descriptor object. The old logic was binding the descriptor to the object, but that's inconsistent with the way things work at runtime.

Enhancement: Improved analysis of `finally` block and the code that comes after the `finally` block so type narrowing performed within the `finally` block in the fall-through case is preserved.

Enhancement: Added support for `Final` and `ClassVar` annotations embedded within `Annotated`. Runtime support has recently been added for this case.

Enhancement: Added support for `InitVar` that is wrapped in `Annotated`. Support is being added for this in the runtime.

Enhancement: Added special-case handling for methods declared as returning a `Generator`, `AsyncGenerator` or `AwaitableGenerator` that do not contain a yield statement. This special case applies only to methods declared in stub files, an abstract method, or a protocol definition with no code.

Bug Fix: Improved support for custom subclasses of the builtin `property` class. Previously, the special-case handling in place for `property` were not handling these custom subclasses well, and this resulted in several false positive errors and incorrect type evaluations.

1.1.214

A regression was introduced in the 1.1.213 release that has the potential of impacting many pyright users, so I decided to do a quick update.

Bug Fix: Reverted change from previous release that caused incorrect type evaluations and false positive errors in certain situations involving bidirectional type inference with call expressions.

Enhancement: Updated typeshed stubs to latest.

1.1.213

Behavior Change: For not-required TypedDict fields, added a second synthesized overload for the two-parameter form of `get` that specifies the type of the second parameter is the same type as the field value. The other overload allows this second parameter to be of a different type.

Bug Fix: Fixed bug that resulted in a false positive when accessing a field in a base class that provides a `__getattr__` method and is use in conjunction with another base class.

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

Bug Fix: Fixed a bug in the logic that detects duplicate enum members that resulted in a false positive when an enum class has other instance variables that are not enum members.

Bug Fix: Added special-case handling for instance variables in a dataclass that are marked `Final`. Previously, these were flagged as an error because there was no explicit value assigned to them, but the synthesized `__init__` method implicitly initializes them.

Enhancement: Added check for a class that derives from a protocol class where the protocol declares a method with an empty implementation, and the subclass doesn't provide a concrete implementation of the same-named method.

Bug Fix: Fixed a bug that resulted in a false positive type evaluation error when using bidirectional type analysis for a call expression and the return type of the call contained a union of a TypeVar and another type and the expected type contained a union with at least one literal type.

Bug Fix: Fixed bug that resulted in confusing error message when dataclass field was annotated with `Self` and then the class was subclassed.

Enhancement: Improved the logic that handles instantiation of a custom metaclass when the name of the new class is passed as a string literal to the metaclass constructor.

Enhancement: Improved the bidirectional type inference logic for lambdas to handle the case where one or more of the matching parameter types was a TypeVar.

Bug Fix: Fixed a bug in the parser that resulted in a false negative when using an assignment expression (walrus operator) in the `if` clause of a list comprehension with no surrounding parentheses.

Enhancement: Added support for bidirectional type inference when an `await` operator is used in an expression.

Bug Fix: Fixed a bug in the logic that handles classes that are constructed from custom metaclasses.

Enhancement: Added provisional support for the proposed "typing.reveal_type" call.

1.1.212

Bug Fix: Fixed bug that resulted in false positive when one or more sources of types in TypeVar solving was unknown.

Bug Fix: Fixed bug that resulted in a crash if a `TypedDict` class was derived from another `TypedDict` class and the base class had zero fields defined.

Enhancement: Added support for ` pyright: basic` comment to enable basic type checking in a file.

Bug Fix: Fixed a bug that resulted in a false positive error when determining whether method overrides for a multi-inheritance chain are compatible.

Bug Fix: Fixed bug that resulted in a false positive when using bidirectional inference with a constructor with complex set of covariant, invariant, and contravariant type parameters.

Enhancement: Improved logic for `type(x) is y` type narrowing pattern so it handles the case where `x` is `Any`.

1.1.211

Enhancement: Added support for very large integer literals (both in the tokenizer/parser and in the type system for Literals).

Bug Fix: Fixed bug where call to async function that returns `NoReturn` was treated as a "no-return" function even though it wasn't awaited.

Enhancement: Added check for class or instance variables that are declared but not assigned in a protocol class and not assigned in a concrete class that explicitly derives from the protocol class.

Bug Fix: Fixed bug in type narrowing logic for `isinstance` calls where the input value includes a `Callable` and the class list includes a class that is not a runtime-checkable protocol class. In this case, the `Callable` should not be removed in the negative ("else") case even if the class defines a compatible `__call__` method.

Bug Fix: Fixed bug that resulted in a false positive error when assigning a value to a TypedDict with not-required keys when that key had previously been assigned a literal value that narrowed the type.

Behavior Change: Reverted recent change to TypedDict where the single-argument form of `get` was removed for not-required fields. This caused problems because there is a fallback overload that accepted this case still.

Behavior Change: Changed `reportUnknownArgumentType` diagnostic check to be suppressed if the argument is an empty list or dict that comes from a `[]` or `{}` expression. While these types do technically contain `Unknown` type arguments, they are not unsafe, so reporting a diagnostic here is just noise.

Behavior Change: Changed the implementation of `reveal_type` so it no longer returns a literal string type but now accepts optional keyword arguments `expected_text` and `expected_type`. The return type of `reveal_type` is now the same as the type of the first argument, making it consistent with mypy's implementation of `reveal_type`.

Enhancement: Modified error messages for Required and NotRequired for clarity.

Bug Fix: Fixed bug in parser that resulted in a false negative error when using an assignment expression within a subscript. This is allowed in the grammar as of Python 3.10.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed internal crash caused by infinite recursion.

Bug Fix: Fixed bug that caused a crash in functools.partial special-case logic.

Bug Fix: Fixed bug in type evaluation of index expressions that involve a recursive type alias in the subscript. Also improved text version of expanded types that include recursive type aliases.

Page 31 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.