Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 37 of 81

1.1.180

Bug Fix: Fixed bug that resulted in a false positive error when a generic class used a specialized version of itself parameterized with one of its own type parameters.

Bug Fix: Fixed recent regression where imported symbols that were ultimately resolved with a native library (e.g. a ".pyd" or ".so" file) were incorrectly resolved as a module rather than an Unknown type.

Bug Fix: Fixed a type evaluation regression that caused type arguments to be incorrectly determined when calling a constructor and passing a callable that is generic.

Enhancement: Added broader support for context managers in with statements which swallow exceptions. Thanks to Rik de Graaff for this contribution.

Bug Fix: Added missing error condition for walrus operator used within a type annotation expression.

Bug Fix: Fixed bug in pattern matching type evaluation where `bytearray` was matched against a sequence pattern even though PEP 634 explicitly excludes this case.

Enhancement: Added support for sequence pattern match type narrowing when the subject type is a simple "object".

Enhancement: Added support for type narrowing of enums when using pattern matching.

Enhancement: Added error reporting for usage of type aliases within class pattern matching statements that generate runtime exceptions.

Behavior Change: Changed the printed type of a ParamSpec signature to avoid the use of synthesized parameter names "__p0", etc. Instead, the parameter names are omitted in the signature consistent with the emerging standard for the improved callable syntax.

Enhancement: Added support for explicit specialization of generic classes that include a ParamSpec. This is defined in PEP 612 but was previously missing.

Bug Fix: Fixed bug in check for generator return type. A diagnostic was meant to be generated if the declared return type was incorrect for a generator.

1.1.179

Enhancement: Added support for an unpacked tuple assignment within an instance method when the source of the assignment is the `self` parameter.

Bug Fix: Fixed false positive error in protocol variance check (in the `reportInvalidTypeVarUse` diagnostic rule) when a protocol class used a ParamSpec.

Bug Fix: Fixed bug that caused false positive errors when generic callback protocol class used a ParamSpec and a `__call__` method with only two parameters consisting of `P.args` and `P.kwargs`.

Bug Fix: Fixed bug that resulted in a false positive error when using a generic callback protocol with a ParamSpec where the `__call__` method included a positional-only marker prior to the `P.args` and `P.kwargs` parameters.

Bug Fix: Fixed a bug that results in false positive error when assigning a source union type to a destination union type.

Bug Fix: Fixed an internal crash that was caused by infinite recursion.

Bug Fix: Fixed bug in completion provider that resulted in inappropriate suggestions when typing arguments within a class declaration.

Bug Fix: Changed type logic for sequence pattern matching to produce `list` rather than `tuple` for star subpatterns. This matches the runtime behavior in Python 3.10.

Enhancement: Added support for name expressions in `with` statements where the name refers to a variable or parameter with a declared type that corresponds to a context manager class that swallows exceptions.

Bug Fix: Fixed bug that resulted in a false positive error when a generic class used a specialized version of itself parameterized with one of its own type parameters.

1.1.178

Bug Fix: Fixed false positive error that occurred when importing a symbol in a `from x import y` statement that referred to a chain of imports and was eventually resolved to a native library (e.g. ".pyd" or ".so" file).

Bug Fix: Added missing check for type compatibility between callables where the destination type includes a default argument for a parameter but the source type does not.

Bug Fix: Fixed bug that caused incorrect evaluation of inferred return type based on inferred type of unannotated "self" or "cls" parameter.

Enhancement: Added support for "narrowing" of TypedDict instances on assignment when the TypedDict defines entries that are not required but are supplied.

Behavior Change: Changed the interpretation of a property declared within a protocol class. It was previously interpreted only as a property (i.e. classes compatible with the protocol must implement a property of the same name). Compatible classes are now able to declare an attribute whose type is compatible with the property getter. Access to the property from the protocol class as a class variable is no longer allowed.

Enhancement: Improved error message for improper use of a module as a type argument.

Bug Fix: Fixed a bug in import resolution logic that resulted in incorrect resolution of a symbol in the presence of wildcard imports that allowed for multiple resolution paths, some of them cyclical. Pyright previously gave up when it detected a cycle rather than using a different (non-cyclical) resolution path.

Bug Fix: Improved parser's detection of "match" as a soft keyword versus some other usage of a symbol named "match".

Bug Fix: Fixed bug that resulted in a false negative when a TypedDict value was assigned to a protocol that included attributes that matched the TypedDict keys.

Bug Fix: Fixed bug that resulted in false positive when a function is used in an `==` or `!=` binary expression.

Bug Fix (from pylance): Fixed bug in import completions for parent directory resolution.

1.1.177

Bug Fix: Fixed bug in stub generation logic. It wasn't properly handling module paths with more than a single ".", such as "google.cloud.storage".

Bug Fix: Fixed false positive error in certain cases where type variable was bound to a union.

Enhancement: Implemented check for an attempt to subclass an Enum class that defines one or more enumerated values. This condition generates a runtime exception.

Enhancement: Type aliases in the printed form of a union type are retained when aliased types are combined in a union.

Bug Fix: Fixed bug in completion provider's handling of key completions for TypedDicts.

Bug Fix: Fixed false positive type evaluation error when constrained TypeVar is assigned to a union that contains a compatible constrained TypeVar.

Bug Fix: Added code to work around the circular definition found in the typeshed stub that defines the os.scandir function.

1.1.176

Enhancement: Exempted check for unsafe access to TypedDict key if it's within a context manager. It was previously exempted if included in a `try` block, but some prefer to use a context manager to catch exceptions.

Behavior Change: Bumped pyright's default Python version from 3.9 to 3.10.

Enhancement: Added support for "bare" `ClassVar` annotations.

Enhancement: Updated to the latest version of typeshed stubs.

Enhancement: Added new "--warnings" command-line option that generates an exit code of 1 if one or more warnings are emitted. By default, only errors generate an exit code of 1.

Bug Fix: Fixed bug that resulted in a "unknown member of module" error if the member referred to a submodule that was imported privately from another module but that submodule was also explicitly imported. For example, if a module imports both `a` and `a.b` and then uses the symbol `a.b.c`.

Enhancement: Added new diagnostic check "reportMissingParameterType" that checks for function and method input parameters that are missing a type annotation.

Enhancement: Added support for new type guard pattern: `x[I] is None` and `x[I] is not None` where `x` is a tuple or union of tuples with known lengths and entry types and `I` is an integer.

Enhancement: Enhanced the stub generation logic to emit `__all__ = ...` and `__all__ += ...` statements when they appear in the module scope and are not within a conditional (if/else) block.

1.1.175

This is a "hot fix" release that addresses two regressions introduced in 1.1.174.

Bug Fix: Reverted a change that broke the use of generic dataclass types.

Bug Fix: Reverted a change that resulted in a false positive error when subclassing an Enum base class that defined no enumerated values.

Page 37 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.