Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 3 of 81

1.1.381

Bug Fixes:
* Fixed bug that results in incorrect type narrowing for sequence patterns in the negative (fall-through) case when the subject is a tuple with an unbounded entry.
* Fixed recent regression that results in a false positive error when attempting to assign the expression `type(Any)` to type `type[Any]`.
* Fixed a bug that results in incorrect evaluation of a variable in a doubly-nested loop that is assigned a value in an assignment expression.
* Fixed a bug that results in incorrect narrowing of types for `TypeIs` user-defined type guard in certain cases when variable type is a union.
* [Contribution by dcolascione] Fixed bug that results in a condition where imports stop resolving after file edits that change the set of modules that a file imports.
* Fixed recent regression that results in incorrect type narrowing for `isinstance` in the negative case when using `type` as a filter.
* Fixed bug that results in incorrect reporting of the Python version in a deprecation diagnostic message.
* Fixed bug that results in incorrect code flow involving a call to a `NoReturn` callable with a function decorator applied.
* Fixed bug that results in a spurious "symbol refers to itself" error under very specific conditions.
* Fixed bug that can theoretically result in spurious errors when evaluating expressions that involve parameter symbols.
* Fixed bug that results in incorrect type narrowing when `TypeIs` intersects `type[A]` with `type[B]`. Previously, pyright was producing `<subclass of type[A] and type[B]>` but now produces `type[<subclass of A and B>]`.
* [From pylance] Fixed recent regression that caused `venvPath` specified in language server settings to be ignored.
* Fixed bug that results in a confusing error message extension referencing a missing `__set__` method when assigning to a class variable that is not a descriptor object.
* Fixed a bug that results in a false positive type error and confusing error message when assigning to a class variable that uses `Self` in its type definition.
* Fixed a bug that results in spurious "variable not allowed in type expression" errors when a type alias is used in a loop in both a type expression and a value expression.

Behavior Changes:
* Updated provisional support for `TypeForm` based on feedback to draft PEP 747.

Enhancements:
* Expanded `reportUnnecessaryIsinstance` check to report cases where an `isinstance` or `issubclass` call always evaluates to `False`.
* Improved error message for type violation in assignment statement where the LHS is an instance variable reference.
* [From pylance] Update Unicode range tables to match Unicode 16.0, which is used for Python 3.14.

1.1.380

Bug Fixes:
* Fixed a recent regression that results in incorrect type evaluation when using a two-argument form of `super()` and the second argument is `type[Self]`.
* Fixed a recent regression that results in a false positive type error when converting certain constructors (such as for the class `defaultdict`) to a callable type.
* Fixed recent regression that results in a false positive under certain specific circumstances involving higher-order functions that return generic callable types.
* Fixed a bug that results in a false positive error during protocol matching because writable class variables defined in a named tuple or a frozen dataclass were considered read-only.
* Fixed a bug that causes incorrect type narrowing of expressions used within a tuple expression in the subject expression of a `match` statement.
* Fixed a bug that results in an incorrect type evaluation of a higher-order function that is passed an overloaded function.
* Fixed recent regression that results in a false positive error under very specific circumstances involving a function with a TypeVar used in both a contravariant and covariant context and combined by union with other types in the contravariant context.
* Fixed a bug that leads to a false positive "default value is specified as ..." when using `--verifytypes` and the function has a decorator applied that uses a ParamSpec.
* Simplified check for unnecessary isinstance call. Removed a bunch of redundant code and fixed a number of bugs in the process.
* Fixed a bug that leads to incorrect type narrowing with `isinstance` or `TypeIs` when the filter type (the second argument to `isinstance`) is a subclass of `type`.
* Fixed bug that results in incorrect type narrowing for the `in` (containment) operator when the filter includes class objects (instances of `type`).
* Fixed a bug that results in incorrect type narrowing for the `x is ...` (ellipsis) type guard pattern.
* Fixed a bug in the stub generator so it properly outputs type aliases that use the PEP 613 `TypeAlias` qualifier.
* Fixed bug that causes a crash in the language server under certain circumstances with partially-written code that has syntax errors.
* Fixed a bug that results in incorrect type narrowing for `TypeIs` when it is used with a `Callable` type form.
* Fixed several inconsistencies and bugs in the `isinstance` type narrowing code involving callables

Enhancements:
* Added performance optimization to better handle the case where a tuple expression contains thousands of entries. This is not typically found in hand-written code, but it can appear in computer-generated code.
* Added support for custom metaclasses that derive from `ABCMeta`. Classes instantiated from such metaclasses are now treated as abstract.
* Updated typeshed stubs to the latest version.

Behavior Changes:
* Changed the behavior of the dictionary expansion operator (`**`) when used in an argument expression for a call and the operand is a TypedDict. It now takes into account the fact that a (non-closed) TypedDict can contain additional keys with `object` values. This new behavior is consistent with mypy.
* Removed support for python-2 raise statements with comma-delimited operands.
* Changed behavior of raise evaluation logic to allow type of exception to be `Never`.
* Changed behavior to allow a value with type `_AnnotatedAlias` to be used with an implicit `__getitem__` call even though this type is not documented or declared in typeshed.
* Changed stub generator to avoid emitting a `from __future__` import statement, which has no meaning in stub files.
* Removed support for custom `callable` type guard pattern. Now that typeshed defines this with a `TypeIs`, we no longer require custom logic here.

1.1.379

Bug Fixes:
* Fixed a bug that results in confusing hover information for an attrs field that uses a converter.
* Fixed bug that results in incorrect type evaluation when assigning a recursive type alias to a tuple or list.
* Fixed a bug that can result in difficult-to-reproduce type evaluation errors when modifying code in your editor and using pyright as a language server.
* Fixed bug that results in the incorrect type when the `Callable` special form is used in a value expression.

Enhancements:
* Added check for concatenated bytes and str literals.
* Added provisional support for draft PEP 747 and the `TypeForm` special form.
* Updated some diagnostic strings to refer to "type expression" rather than "type annotation" since they apply to some cases that don't involve annotations.

1.1.378

Bug Fixes:
* Fixed bug that results in incorrect logging of the pythonVersion string.
* (from Pylance) Fixed issue that resulted in the incorrect pythonVersion when a pyproject.toml is present with a "[tool.pyright]" section.
* Fixed a bug that results in false negatives for errors in argument expressions used in a call to `functools.partial` in some cases. This same issue also causes symbols accessed in these arg expressions to not be marked as referenced.
* Fixed bug that results in a crash in very specific circumstances that involve binding a method parameterized by a function-scoped ParamSpec.
* Fixed a bug that resulted in incorrect evaluation when converting a constructor to a callable and the constructed class has a metaclass with a `__call__` method whose `cls` parameter is annotated with `type[T]`.
* Fixed bug that results in a `reportIncompatibleMethodOverride` diagnostic being reported in the wrong location in some cases involving decorators.
* Fixed a bug that results in a false negative when overloads overlap due to default values.

Behavior Changes:
* Changed the default value of the `disableBytesTypePromotions` setting from `false` to `true`. It has been over two years since PEP 688 was accepted, so it's time for us to stop treating `bytes` as an alias for `bytes | bytearray | memoryview`. This is a breaking change and may require an update to the pyright configuration for some code bases.

1.1.377

Bug Fixes:
* Fixed bug that results in a crash under certain circumstances when a ParamSpec without a scope is used illegally to specialize a class.
* Fixed a bug that results in a false positive error when assigning a `TypeGuard[T]` or `TypeIs[T]` to a supertype of `bool` (like `int`).
* Fixed a bug that leads to a crash when `--pythonversion` and `--threads` CLI options are used together.
* Fixed a bug that leads to incorrect type evaluation in certain specific conditions involving a function decorator with an return type inferred from an inner function parameterized by a ParamSpec.
* Fixed bug that results in a false positive error under very specific conditions involving a recursive type alias that is defined in terms of another type alias.

Enhancements:
* Changed type checking logic to retain a reference to default expressions in function signatures, including synthesized signatures (such as `__init__` methods in dataclasses). This allows the original default value expression to be printed in error messages and language server strings.
* Updated typeshed stubs to the latest version.
* Added unreachable code reporting for case statements that are never matched based on type analysis.

1.1.376

Bug Fixes:
* Fixed bug that results in a crash when an empty tuple is used to specialize a generic type alias parameterized by a ParamSpec.
* Fixed a bug that results in a false positive reportInconsistentOverload error when the implementation of the overload includes a decorator that changes the type of the implementation to a non-function type.
* Fixed bug that results in a false positive error when type argument for `Literal` doesn't follow type expression rules within a value expression context.
* Fixed regression that resulted in a hang when determining whether an overload implementation with generics was compatible with its overloads.
* Fixed bug that results in a false negative `reportIncompatibleMethodOverride` when the child class method uses a type parameter that is scoped to the child class.
* Fixed bug that produces signatures with extra (unnecessary) positional-only and keyword-only separators when using a TypedDict with zero fields.
* Improved consistency of parameter name restrictions for the `reportSelfClsParameterName` check. Previously, different rules were applied to `__new__` and class methods within metaclasses.
* Fixed a false positive error when solving type variables in a call that involves a lambda.
* Fixed bug that results in a confusing type in an error message when `isinstance` type narrowing between a `type` and another type creates a subclass.
* Fixed bug that leads to false positive error when a protocol has a read-only property a class has a Final variable.
* Fixed bug that leads to a hang under certain circumstances involving deeply-nested higher-order functions.
* Fixed bug that results in a confusing type in an error message when `isinstance` type narrowing between a `type` and another type creates a subclass.

Enhancements:
* Enhanced argument-to-parameter matching logic to support dictionary unpacking where the dict key type is a union of literals.

Behavior Changes:
* Changed composition of settings that affect type checking behaviors. Previously, some LSP settings that affect type checking could override config files. Now, the config file always "wins". Command-line parameters passed to the CLI version of pyright win over both LSP settings and config files.
* Changed synthesized comparison methods (`__lt__`, etc.) for dataclasses when `order=True` to use `Self` rather than an instance of the class. This is not only more consistent with other synthesized methods, but it also preserves covariance of type variables if the dataclass is frozen.
* Changed behavior for protocols that have methods with method-scoped type variables. These are no longer treated as free type variables during protocol matching, so they can be used to support rank-2 polymorphism. This behavior is not currently dictated by the typing spec, but it is more consistent with mypy.

Page 3 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.