Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 51 of 81

1.1.95

Behavior Change: Changed encoding of diagnostics reported through the LSP interface. The diagnostic rule (if applicable) is now reported in the "code" field, and a URL points to general documentation for diagnostic rules.

Enhancement: Added support for type arg lists specified in a tuple expression (like `Dict[(str, str)]`) which is a legal way of writing type annotations.

Bug Fix: Fixed infinite recursion due to a `__call__` method that returns an instance of the class that is being called.

Bug Fix: Fixed bug that caused completion suggestions not to work for member accesses when the LHS of the expression was a type specified in the form `Type[X]`.

Bug Fix: Fixed bug that resulted in an attempt to parse and bind a native library (binary file) resulting in long latencies and out-of-memory errors.

Enhancement: Improved error message for unknown named parameters for TypeVar constructor.

Bug Fix: Fixed recent regression that causes a crash in certain circumstances when binding a method to an object or class in cases where that method doesn't have a "self" parameter but instead just has `*args` and `**kwargs` parameters.

Bug Fix: Fixed bug that resulted in incorrect reporting of unreported variables or parameters when they are accessed within argument expressions in cases where an error is detected when analyzing a call expression.

Enhancement: Expand ${env:HOME} in settings. Thanks to ashb for the contribution.

Bug Fix: Fixed bug that generated incorrect errors when a callable type included another callable type as an input parameter and the second callable type had generic parameter types.

Bug Fix: Fixed bug that caused a false negative when a default parameter value was assigned to a parameter with a generic type annotation.

Bug Fix: Fixed bug that caused incorrect error to be reported when applying logical operators ("|", "&" or not) to enum.Flag literals.

1.1.94

Bug Fix: Fixed potential source of infinite recursion in type evaluator.

Behavior Change: Changed behavior of tuples to strip literals when converting the variadic list of type arguments into a single "effective" type argument. This means the expression `list((1,))` will now be evaluated as type `list[int]` rather than `list[Literal[1]]`.

Bug Fix: Fixed bug in parser that generated an inappropriate syntax error when an annotated variable assignment included a star test list on the RHS with an unpack operator.

Enhancement: Added support for context managers that are designed to suppress exceptions.

Bug Fix: Fix infinite recursion in logic that maps pyi files to py files.

Enhancement: Improved source maps for better stack traces, useful for bug reports.

1.1.93

Enhancement: Added support for TypeVar objects that are used outside of type annotations.

Bug Fix: Fixed bug that caused incorrect error when performing binary operations (arithmetics, comparisons, etc.) on classes that define corresponding magic methods that are instance methods. When performing the operation on the class, the magic methods in the metaclass should be used instead.

Enhancement: Added support for frozen dataclasses. Errors are now reported if a frozen dataclass inherits from a non-frozen dataclass and if an attempt is made to set the member of a frozen dataclass.

Bug Fix: Added support for "bytes" type promotions for bytearray and memoryview.

Bug Fix: Added support for static methods and class methods that are invoked on non-specialized generic classes where the arguments to the method provide sufficient context to fill in the missing class-level type arguments.

Behavior Change: Changed reportWildcardImportFromLibrary diagnostic rule so it doesn't apply to type stub files.

Bug Fix: Fixed bug that resulted in incorrect error when attempting to assign a constrained TypeVar to a union type that satisfied all of the constrained types.

Bug Fix: Added support for binary operator magic methods that operate on constrained TypeVars.

Bug Fix: Fixed the logic that determines whether a type can be assigned to another type when invariance rules are in effect - in particular when the destination is a union. Previously, the unions needed to match exactly. The new logic takes into account whether the destination union contains subtypes that are subclasses of each other.

Bug Fix: Fixed bug where None and Callable types could be assigned to "object" even when invariant rules were in effect. This allowed `List[None]` to be assigned to `List[object]`.

1.1.92

Bug Fix: Fixed bug in parser that resulted in the opening parenthesis ("(") in a parenthesized expression or tuple not being included in the parse node range.

Bug Fix: Fixed bug that could result in "unaccessed variable" error for variables that were referenced in argument expressions if there were other errors related to the call expression.

Bug Fix: Fixed bug in logic dealing with comment-style function annotations that resulted in spurious errors if "self" was used within an instance method that was so annotated.

Bug Fix: Fixed bug that caused errors when a hierarchy of dataclass classes used generic types for one or more dataclass members.

Bug Fix: Fixed bug in type checker where it allowed invariant type parameters to violate invariance if the destination was an "object" instance.

Bug Fix: Fixed off-by-one error in fstring parsing with debug variables that resulted in errors if the "=" was not preceded by a space.

Bug Fix: Fixed bug in logic that validates the assignment of a callable type to a generic callable when one of the parameters is another callable.

Bug Fix: Fixed bug that affected generic type aliases that included callable types.

Bug Fix: Fixed bug in bidirectional type inference logic when RHS includes call that returns a generic type. The old logic was prepopulating the type associated with that TypeVar but prevented the type from being further narrowed. This resulted in incorrect errors with argument expressions in some cases.

Enhancement: Added PEP 604 support for unions passed as the second argument to isinstance and issubclass.

Enhancement: Improved error messages for binary operations that involve a TypeVar for one of the operands.

Enhancement: Updated the reportMissingTypeArgument diagnostic check to apply to bound types in TypeVar declarations.

1.1.91

Enhancement: Updated to the latest typeshed stubs.

Bug Fix: Fixed bug in fstring parser that generated "unexpected token at end of string" errors if fstring debug (introduced in Python 3.8) was used in conjunction with string-formatting syntax and there was no space between the "=" and the ":".

Bug Fix: Fixed bug that caused a spurious error when defining a property setter when the property getter had no declared return type.

Bug Fix: Fixed bug in isinstance narrowing logic where it didn't properly preserve a TypeVar in the negative ("else") case.

Bug Fix: Fixed bug in type narrowing logic for member access expressions like "a.b.c". A narrowed type needs to be abandoned if any part of the expression is reassigned (e.g. a.b = <expression>).

Bug Fix: Fixed bug that resulted a "Never" type appearing as a type argument in an inferred function return type. "Never" should never be used as a type argument. It is now replaced by "Unknown" if it ever does appear.

Bug Fix: (from pylance): Fixed completion case where the completion item said one method, but hover said another once inserted.

Bug Fix: (from pylance): Reuse existing imports for auto-imports (e.g. if `import os.path` is present, `join` will use `os.path.join`).

1.1.90

Enhancement: Added support for type() call when argument contains a generic class instance.

Enhancement: Improved reportIncompatibleMethodOverride diagnostic check for property overrides. It now checks for missing fget, fset, fdel methods and the overridden method types for each of these.

Enhancement: Added special-case handling of overloaded `__init__` methods where the `self` parameter contains an annotation with a specialized version of the class. This is used in some typeshed stubs to influence the constructed object type when no additional information is available.

Bug Fix: Fixed bug in parser that resulted in incorrect errors when an unpack operator was used within an f-string expression.

Bug Fix: Fixed bug that resulted in incorrect errors when matching synthesized "cls" parameter type. This bug generally affected all TypeVars that were bound to a Type.

Enhancement: Improved type checking support for constrained TypeVars within function and class bodies. This was a significant change, so there's some risk of regressions or new false-positive errors. Please report any bugs you see.

Page 51 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.