Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 20 of 81

1.1.280

Bug Fix: Fixed bug that led to an incorrect type evaluation (and potential false negative) when an iterable iterates over an unpacked TypeVarTuple.

Bug Fix: Enabled the `Never` type to be used as an explicit type argument for a contravariant parameter.

Bug Fix: Fixed a bug in the type printing logic where it omitted a `Union` when an unpacked `TypeVarTuple` is used within a `Union`.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when the type arguments for a tuple included an unpacked TypeVarTuple. In this case, the type argument should be treated as a `Union[*Ts]` rather than `*Ts`.

Bug Fix: Fixed a bug that resulted in a false positive for the `reportIncompatibleMethodOverride` check when the base method used an unpacked `tuple` for the `*args` parameter and the override used specific parameters.

Bug Fix: Fixed a bug that resulted in a false negative when a non-frozen dataclass subclasses from a frozen dataclass. This generates a runtime error, so it should be flagged by the type checker.

Bug Fix: Fixed a bug that resulted in a false positive error related to type narrowing in a `match` statement when matching against an enum with only one value.

1.1.279

Behavior Change: Changed the way pyright handles the case where a dataclass or dataclass-like class handles a synthesized `__init__` if one or more base classes are unknown.

Bug Fix: Fixed bug in type printer logic that resulted in a triple `*` before an unpacked TypedDict when it was used with a `**kwargs` parameter and the TypedDict was generic.

Bug Fix: Fixed a bug that resulted in a false positive when invoking the constructor for a generic class that uses an unpacked TypedDict with an `**args` parameter.

Bug Fix: Fixed regression that caused non-JSON output to be emitted when `--verifytypes` is used in conjunction with `--outputjson`.

Behavior Change: Changed the `reportUninitializedInstanceVariable` so it doesn't run on stub files.

Enhancement: Added new diagnostic rule `reportShadowedImport` that emits a diagnostic if a local module shadows a stdlib module.

Bug Fix: Fixed a bug that resulted in a false positive when a call expression includes an unpacked argument that is a tuple with a known length.

Bug Fix: Reverted recent change to the reportUnnecessaryComparison check that introduced a regression.

Bug Fix: Fixed a bug that resulted in a false negative when a `*args` parameter with an unpacked tuple is followed by additional keyword-only parameters that are not supplied by a caller.

Bug Fix: Added code to clean up the temp directory that pyright creates when determining whether the file system is case sensitive.

Bug Fix: Fixed bug that resulted in false positive error when evaluating an unpacked tuple or TypeVarTuple in an `*args` parameter annotation.

Bug Fix: Improved argument/parameter matching for unpacked tuple arguments.

Bug Fix: Fixed a bug in detection of variance inconsistency with base classes in a class definition.

Enhancement: Added support for detecting unhashable types within set and dict expressions. These result in a TypeError at runtime.

Bug Fix: Fixed bug that resulted in poor hover text message for keyword arguments passed to a TypedDict constructor.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation when a generic class implicitly referenced one of its own magic methods (e.g. `__iter__`).

Enhancement: Added support for recursive type references when using the functional "alternative syntax" for `TypedDict`.

Behavior Change: Changed the synthesized `__dataclass_fields__` variable in dataclass to be a `ClassVar` so it cannot be overridden by an instance variable.

Behavior Change: Changed protocol matching logic to enforce that a protocol with a `ClassVar` requires that any compatible class also declare the corresponding field as a `ClassVar`. Previously, any class-scoped variable satisfied the protocol in this case. This change brings pyright and mypy into agreement.

Bug Fix: Fixed a bug that resulted in incorrect type evaluation involving a recursive type alias that is defined as the union of other types, one of which introduces the recursion.

1.1.278

Behavior Change: Changed the `reportUnusedImport` check to not report an error for "from y import x as x" since `x` is considered to be re-exported in this case. Previously, this case was exempted only for type stubs.

Enhancement: Expand enums in negative narrowing of `x in y`.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when an f-string uses expressions that are unions of literal strings. The result should be `LiteralString`, not `str`.

Enhancement: Improved the `reportUnnecessaryComparison` diagnostic check to detect (and properly report) cases where a comparison if literals is always true or always false.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when creating a union from two generic functions that are parameterized by different ParamSpecs but are otherwise identical.

Behavior Change: Updated the default Python version from 3.10 to 3.11 now that 3.11 has been released in its final form. Pyright assumes the default version if it is not otherwise told which version to use (explicitly as a setting or command-line argument or implicitly via the selected Python environment).

Enhancement: Enhanced `--verifytypes` so it honors the `--pythonversion` and `--pythonplatform` command-line arguments and falls back to the selected Python environment to get these values if they are unspecified.

Bug Fix: Fixed a bug in the type evaluator related to TypeVarTuple that caused it to incorrectly report a type incompatibility between `*Ts` and `*tuple[*Ts]`. These are the same type, so they should be compatible.

Bug Fix: Fixed a bug that results in incorrect specialization of a function or method that uses a TypeVarTuple parameter. The internal flags were being lost including the tracking of class methods and static methods.

Bug Fix: Added support for unpacked tuple arguments passed to an `*args` parameter declared with a TypeVarTuple.

1.1.277

Enhancement: Added support for falsy type guard expressions when the evaluated type is a NamedTuples with at least one element. These always evaluate to True.

Bug Fix: Fixed bug that resulted in a false positive "possibly unbound" error when a builtin symbol is overridden in the global scope within a conditional block.

Enhancement: Improved error message for TypeVar constraints that contain generics. Fixed a bug that prevented an error message when keyword argument was duplicated in a call to `TypeVar`.

Enhancement: Added support for `infer_variance` parameter to `TypeVar` as specified in draft PEP 695.

Bug Fix: Improved consistency of assignment-based type narrowing when the type of the assigned value includes an `Any` or `Unknown` type argument that is nested more than one level deep and the expected (declared) value contains a type argument that is not `Any`.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed bug that results in a false positive error when a protocol class implements an overloaded method.

Bug Fix: Added a workaround for a recent change to the typeshed stub dataclasses.pyi relating to the `InitVar` class. For Python 3.8, the stub indicates that the `InitVar` class has a metaclass called `_InitVarMeta` that has a `__getitem__` method that returns a value of type `InitVar[Any]`, but this creates a circularity because the evaluation of the expression `InitVar[Any]` depends on the return type of `_InitVarMeta.__getitem__`.

1.1.276

Enhancement: Updated typeshed stubs to the latest version. This includes the removal of stubs for freezegun.

Enhancement: Added support for draft PEP 698 and the `override` decorator.

Enhancement: Enhanced `reportSelfClsParameterName` so it applies to overload signatures. In the general case, this check is not applied to functions with decorators because decorators can change the semantics of parameters for the decorated function. But `overload` is a special case, and its semantics are well known.

Enhancement: Extended the `defineConstant` mechanism to work with conditional statements that contain member access expressions that reference a defined member name.

1.1.275

Bug Fix: Fixed a bug that resulted in an incorrect type evaluation when a TypeVar bound to an `Enum` class is instantiated.

Bug Fix: Added a global "cache manager" to track heap usage for all type analyzer service instances. This prevents out-of-memory conditions when many roots are used in a multi-root workspace.

Behavior Change (from Pylance): Don't treat classes decorated with `dataclass_transform` as dataclasses for purposes of determining which fields should be represented in the synthesized `__init__` method. This was an ambiguity in PEP 681, which was recently clarified.

Bug Fix: Fixed a bug that resulted in a false negative when using illegal annotation expression forms within a `TypedDict` inlined (call-based) definition.

Bug Fix: Fixed a bug in the code flow engine that resulted in incorrect type evaluation in certain cases involving nested loops.

Bug Fix: Fixed a bug that resulted in a false positive error when a call targets an object with a `__call__` that is itself an object with a `__call__` method.

Bug Fix: Added a check for a return statement with an explicit return value within an async generator function. This is considered a syntax error by the Python compiler, so it should be flagged at static analysis time.

Bug Fix: Fixed a bug that resulted in incorrect handling of binary files (e.g. ".so" or ".pyd" files) within a library when creating stub files.

Behavior Change: Enhanced the heuristics used to infer the type of an unannotated function parameter with a default value. If that value evaluates to an instance of a class with a private name (i.e. it starts with an underscore), pyright will now assume that the value is potentially a singleton sentinel value similar to `None` and will infer the type to be a union of that type and `Unknown`.

Page 20 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.