Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 50 of 81

1.1.101

Bug Fix: Fixed false negative for "reportUnknownParameterType" diagnostic rule when all function parameters were unannotated.

Bug Fix: Fixed a couple of issues with TypeGuard. Previously, `TypeGuard` was implemented as an alias to `bool` which meant that `bool` was assignable to `TypeGuard` in all circumstances. Now it is special-cased to be assignable only in return statements.

Bug Fix: Fixed bug that caused definition provider to not fully resolve a submodule symbol in certain cases.

Enhancement: Added support for aliases of imported module "sys" when evaluating "sys.platform" and "sys.version".

Behavior Change: Suppressed "Covariant type variable cannot be used in parameter type" diagnostic in the case of an "__init__" method to match mypy behavior.

Bug Fix: Fixed regression that broke type inference for packages with no "py.typed" file and no stubs when "useLibraryCodeForTypes" was enabled.

1.1.100

Bug Fix: Fixed bug that caused "Type" with no type argument not to be flagged as an error.

Enhancement: Changed pythonPlatform to accept a value of "All" in which case no particular platform will be used over the others.

Bug Fix: Fixed bug that caused improper error when using "self" in a "raise ... from self" statement.

Bug Fix: Fixed bug that caused false negative when using a generic type alias with no type arguments.

Bug Fix: Added cache for logic that determines whether a context manager swallows exceptions (and hence acts like a try/except statement). This cache not only improves performance of code flow walks but also prevents infinite recursion in rare cases.

Behavior Change: Improved handling of unannotated decorator functions. If the decorator returns a function that accepts only *args and **kwargs (which is common), the type checker now assumes that the decorated function or method's signature is unmodified by the decorator. This preserves the original signature and docstring.

Bug Fix: Fixed bug that caused types within a "finally" clause to be evaluated incorrectly in situations where the "try" and all "except" and "else" clauses returned, raised, or broke.

Enhancement: Changed error messages that refer to "named" parameters and arguments to "keyword", which is more standard for Python.

Bug Fix: Fixed bug in declaration provider where the declaration of a member wasn't properly resolved when the LHS of the member access was a call to a function that returns a `Type[X]`.

Bug Fix: Fixed bug that manifest as a problem with enums but was actually a problem in handling the circular dependency between "type" and "object" classes (since "type" is an object and "object" is a type).

Bug Fix: Fixed bug that caused incorrect type evaluation when a class was assigned to a generic protocol that was satisfied by the class's metaclass if the class also derived from a base class that also satisfied the same protocol.

Enhancement: Added code to test for missing annotation in `Annotated`.

Bug Fix: Fixed false negative where a union type was assigned to a constrained type variable. An error should be generated in this situation.

Enhancement: Added additional validation for TypeVar scoping. If an outer class defines the scope for a type var, functions and variables within an inner class cannot use a TypeVar of the same name.

Bug Fix: Improved handling of "py.typed" for namespace packages and packages with submodules.

Enhancement: Added support for `__index__` magic method when used with `__getitem__` or `__setitem__` magic methods.

Enhancement: Added support for matching modules against protocols as specified by PEP 544.

Bug Fix: Fix for missing docs in completion list due to only checking the setter for docs because its definition comes after the getter.

1.1.99

Enhancement: Improved error messages for expected TypeDicts. (Contribution from Sam Abey.)

Bug Fix: Fixed bug where an *args or **kwargs parameter could be specified by name in a function call.

Behavior Change: Changed behavior of kwargs parameter that has a generic (TypeVar) type annotation. Literals are now stripped in this case before assigning to the TypeVar.

Enhancement: Improved mechanism for overloaded `__init__` method that uses `self` parameter annotation to specify the result of a constructor. The new mechanism supports generic type arguments within the `self` annotation.

Bug Fix: Fixed bug that caused sporadic errors when modifying the builtins.pyi stub file.

Bug Fix: Fixed bug with overlapping overload detection. It was reporting an incorrect overlap when a different TypeVar (bound vs unbound) was used in two overloads.

Bug Fix: Fixed another false positive error related to overlapping overload methods with a TypeVar in a parameter annotation.

Bug Fix: Fixed bug that caused internal stack overflow when attempting to assign a class to a protocol that refers to itself.

Enhancement: Improved support for protocol matching for protocols that include properties. Getter, setter and deleter methods are now individually checked for presence and type compatibility, and generics are now supported.

Enhancement: Updated to latest typeshed stubs.

1.1.98

New Feature: Added new diagnostic rule "reportUnusedCoroutine" that reports an error if the result returned by an async function is not consumed (awaited, assigned to a variable, etc.). This detects and reports a common error when using async coroutines.

Enhancement: Improved error messages for invalid type annotation syntax usage.

Enhancement: Updated to the latest typeshed stubs.

Bug Fix: Fixed recent regression in error message for bound TypeVars that resulted in a confusing message.

Bug Fix: Fixed bug in error messages for parameter type incompatibility; reported parameter number off by one leading to confusing message.

Bug Fix: Fixed bug in type compatibility logic when the destination was a metaclass instance and the dest was a class that derived from that metaclass.

Bug Fix: Fixed bug that caused failure in protocol type matching when the protocol contained a method with an annotated "self" parameter.

Behavior Change: If a class derives from a protocol class explicitly, individual members are no longer type-checked. This improves performance of type evaluation in some cases.

Bug Fix: Fixed bug whereby the presence of a `__getattr__` method on a class with no `__init__` method generated an incorrect error when instantiating the class.

Enhancement: Implemented complete support for module-level `__getattr__` functions as described in PEP 562.

Behavior Change: Eliminated restriction that prevented the analysis of text files that don't end in ".py" or ".pyi".

1.1.97

Enhancement: Improved type analysis performance in cases where an expression contains deeply-nested expressions that involve calls to overloaded functions or bidirectional type inference.

Bug Fix: Fixed bug in ParamSpec logic that affected the case where a generic function with specialized parameters was matched to the ParamSpec.

Bug Fix: Fixed bug where a union with a NoReturn subtype could have been generated when evaluating a union of iterable types.

Enhancement: Improved type narrowing logic for "a is b" narrowing in the case where b is a union that contains both literal and non-literal subtypes.

Enhancement: Added error condition for the situation where an overloaded function is used in conjunction with a ParamSpec.

Bug Fix: Fixed bug that resulted in a false negative error when performing type assignment checks for functions that contain unspecialized type variables.

Enhancement: Improved error messages that include type variables. The scope that defines the type variable is now included. This avoids confusing and seemingly-contradictory error messages like "type _T cannot be assigned to type _T".

Bug Fix: Fixed bug that caused type evaluator to generate different results if someone hovered over the name of a type variable within an index expression before the entire source file was analyzed.

1.1.96

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: Switched to LSP-native progress reporting rather than using custom progress reporting messages.

New Feature: Added a new diagnostic rule called "reportInvalidTypeVarUse" that flags errors when TypeVars are used incorrectly. In particular, it flags the use of a single instance of a TypeVar within a generic function signature.

Bug Fix: Fixed assertion (and associated crash) that results when an LS client asks the language server to open a non-Python file (i.e. one whose file name doesn't have a ".py" or ".pyi" extension). The server now ignores such requests rather than crashing.

Enhancement: Enhanced ParamSpec mechanism to support parameters that have default values.

Bug Fix: Fixed issue with variable expansion for environment variables used within settings.

Enhancement: Improved error message for yield type mismatch.

Performance Improvement: Added a heuristic to skip call-site return type inference if the number of arguments is above a threshold (6). This avoids long analysis times for complex unannotated functions.

Bug Fix: Fixed bug in error message for tuple size mismatches in the case where the source tuple has indeterminate length and the dest has a specified length.

Bug Fix: Fixed incorrect assertion (which manifests as a runtime crash) when assigning to a type that is a generic class with no specified type arguments.

Enhancement: Added new error for a protocol class that derives from a non-protocol base class.

Behavior Change: Changed the logic for `Type` vs `type` such that `Type` (the capitalized form) is always used in cases where there is a type argument (such as `Type[int]` or type[str]` and `type` is used in cases where the non-generic class `type` is intended. This allows `type` to be used in `isinstance` type narrowing.

Bug Fix: Fixed bug in function assignment logic in the case where the destination function has name-only parameters and the source has positional parameters that match those name-only parameters.

Behavior Change: Changed heuristic for when a decorator should be ignored for purposes of type checking. It was previously ignored if the application of the decorator resulted in an "Unknown" type. The new heuristic also ignores the application of the decorator if the resulting type is a union that includes an Unknown subtype. This situation occurs frequently with unannotated decorators where part of the result can be inferred but part cannot.

Bug Fix: Fixed bug that caused incorrect type evaluation when a relative import referenced a submodule with the same name as a symbol that was imported from that submodule if that submodule was later imported again within the same file (e.g. `from .foo import foo, from .foo import bar`).

Enhancement: Added support for protocol callable types when performing bidirectional type inference for lambda expressions.

Enhancement: Improved "isinstance" narrowing to better handle the case where the narrowed expression is a constrained TypeVar. It now preserves the constraint so the value can be assigned back to the TypeVar type.

Bug Fix: Fixed bug in "is None" and "is not None" type narrowing logic when dealing with recursive type aliases.

Page 50 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.