Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 7 of 81

1.1.357

Bug Fixes:
* Fixed bug that results in a false positive error when explicitly calling `__new__` on a dataclass, namedtuple, or TypedDict. These classes all require synthesized `__new__` methods.
* Fixed bug that results in false negative when a `__new__` or `__init__` method cannot be bound without a type violation.
* Fixed a bug that results in incorrect type narrowing of enums that derive from `enum.Flag`.
* Fixed a type hole when a dictionary expression includes a dictionary expansion operator that acts on a non-closed TypedDict.
* Fixed bug that results in a type not being narrowed when using the `K in TD` type guard pattern (where `TD` is a TypedDict and `K` is a literal key). Narrowing was skipped if the RHS operand was not a simple identifier.
* Fixed inconsistent handling of literal values in a list comprehension.
* Fixed a bug that results in a false positive error when an unpacked TypeVarTuple is used in a function defined with PEP-695 syntax.
* (From Pylance) Improved heap usage tracking within language server to reduce the likelihood of crashes related to heap exhaustion.
* Fixed a bug that results in incorrect inferred parameter types for an unannotated method in a subclass when the parent class method contains function-scoped TypeVars.

Enhancements:
* Added support for negative (fall-through) type narrowing for subject subexpressions in `match` statement when subject consists of a tuple expression and patterns exhaustively match the tuple.
* Enhanced dictionary type evaluation to support dictionary items that overwrite previous dictionary items. Only the last value type is now considered, so if previous values (which are overwritten) would otherwise violate typing rules, this no longer generates a type error.
* Enhanced discriminated class support to include not only literal field values but also `None`.
* Improved diagnostic message for access to unknown member in the case where the user probably meant to access an item in a TypedDict but used a member access expression rather than an index expression.
* Improved return result for synthesized `get` method for closed `TypedDict` classes (as defined in PEP 728).
* Refactored tokenizer and parser output to help reduce the amount of memory needed.

Behavior Changes:
* Changed the handling of `Final` variables (that are not explicitly marked `ClassVar`) within dataclass class bodies. This is consistent with the runtime and [this proposed change to the typing spec](https://github.com/python/typing/pull/1669).

1.1.356

Bug Fixes:
* Fixed bug that results in a false positive error when a class-scoped TypeVar with a default that references another class-scoped TypeVar is used in a method signature in that class.
* Fixed bug that resulted in a false positive error if a PEP-695 `type` statement uses a type parameter and encloses the RHS in quotes.
* Fixed bug that results in incorrect type narrowing in the negative (fall-through) case when a runtime-checkable protocol class is used as a class pattern with arguments within a match statement.
* Fixed a bug that results in a false positive when a class-scoped TypeVar used within a method has a default that refers to another class-scoped TypeVar.
* Fixed a bug that results in a false positive `reportImplicitOverride` diagnostic if the class derives from an Unknown or Any class.

Behavior Changes:
* Tweaked bidirectional type inference behaviors for lists to improve certain inference cases.
* Changed the logic for metaclass instance variable lookups to ignore the lookup if the metaclass MRO contains an unknown class.

Enhancements:
* Update Unicode range tables to match Unicode 15.1.
* Added check for the use of a non-runtime-checkable protocol class in a class pattern. This generates an exception at runtime.
* Updated typeshed stubs to the latest version.

1.1.355

Bug Fixes:
* Fixed a bug that results in incorrect type evaluation if a list expression includes a generator expression.
* Fixed bug that results in a false negative when a TypeAliasType object is used in a class pattern.
* Fixed bug that results in false positive when implicitly specializing a class parameterized by a TypeVarTuple when there is no default.
* Fixed bug that results in false positive when a list or set expression is evaluated using bidirectional type inference when the expected type is `MutableSet` or `MutableSequence`.
* Fixed bug that results in a false negative when overriding a method that has keyword parameters with a method that has a `*args` parameter.
* Fixed a bug that results in a false positive error in certain circumstances involving a TypeVarTuple used within an overload.
* Fixed bug that results in a false positive error when a base class defines a writable property and a subclass writes to the property.
* Fixed bug that results in a false positive "overload implementation does not match overloads" diagnostic when positional-only and keyword-only parameters are involved.
* Fixed a bug that results in a false positive in a complex situation that involves generic protocols, properties, and mix-in classes.
* Fixed bug that results in false positive error when a `__new__` method in a metaclass uses PEP 692 (unpacked TypeDict) to annotate its `**kwargs` parameter.

Enhancements:
* Updated typeshed stubs to the latest. This version of typeshed replaces the older-style positional-only parameters with PEP 570 syntax.
* Improved validation for `except` and `except*` statements to catch some previously-undetected invalid cases.
* Expanded handling of python versions to handle more than just major/minor version numbers. Pyright now handles micro, releaseLevel, and serial numbers as well.

1.1.354

Bug Fixes:
* Fixed a bug that resulted in an incorrect type evaluation when an augmented assignment is used within an inner-scoped function to add a constant to a variable. Literal math should not be used in this case.
* Fixed two bugs that resulted in false negatives when redefining a constant variable with a non-variable symbol and when redefining a Final variable with a non-variable symbol.
* Fixed bug that results in false positive when a generic class or type alias uses a TypeVarTuple followed by one or more ParamSpecs that have default values.
* Fixed bug that resulted in false negative when narrowing a constrained or bound TypeVar with a `complex()` or `float()` class pattern.
* Fixed bug that results in a false positive under certain circumstances when a constrained TypeVar is used as the default for another constrained TypeVar.
* Fixed a bug that results in a false positive under certain circumstances when defining a type alias using the old `typing.TypeAlias` annotation.
* Fixed a bug that results in a false negative when a class explicitly inherits from a protocol that defines an instance variable but the child re-declares as a `ClassVar` without an explicit type.
* Fixed a bug that made locale overrides through environment variables no longer work on node 21.

Enhancements:
* Enhanced handling of `type` function when it is passed a class. Pyright previously evaluated this as `Any`, but now it returns the class' metaclass.
* Added check for generic classes and type aliases that include a TypeVarTuple followed by a TypeVar that has a default value. This is illegal according to PEP 696.
* Changed the behavior when accessing a class attribute from a generic class that is not specialized. The class is now automatically specialized in the case using default type parameter values (from PEP 696) or Unknown. This change is required for conformance with PEP 696.
* (From pylance) Added some optimizations to the tokenizer to reduce memory usage.
* Added new `reportUnhashable` diagnostic rule.

1.1.353

Breaking Changes:
* The CLI and language server versions of pyright now require a minimum node version of 14. Previously node 12 and 13 were supported.

Enhancements:
* Enabled PEP 705 and PEP 696 functionality without the use of enableExperimentalFeatures now that these PEPs are officially accepted.
* Improved support for instance variables whose type is declared in a metaclass. Pyright now honors this type and enforces type consistency in derived classes.

Bug Fixes:
* Fixed a bug that results in a false negative when a dundered method overrides a base class method of the same name and uses different parameter names along with different types.
* Fixed a bug that leads to a false positive error when a `match` statement is used in a loop and the subject expression is potentially narrowed as a result of the `match` statement.
* Added check for inappropriate use of `Annotated` passed as second argument to `NewType` call.
* Fixed a bug that results in a false positive error when expanding the type arguments to a TypeVarTuple under certain circumstances.
* Fixed a bug that results in incorrect type evaluation when an index expression is assigned a value within a doubly-nested loop under certain circumstances.
* Fixed a regression that caused the signature help provider to not display the `__new__` method of a constructor if it is overloaded.
* Fixed hard-coded type information for module attribute `__package__`. It should be `str | None` rather than `str`.
* Fixed a bug in the `isinstance` type guard logic. It was not properly handling tuples that included unions.
* Fixed bug in signature help provider so `str` method docstrings are showed when called on `LiteralString`.
* Fixed a bug that results in incorrect type narrowing behavior for member access expressions under certain circumstances.
* Fixed bug that resulted in a false negative when a possibly-unbound variable is captured by an inner scope under certain circumstances.

1.1.352

Enhancements:
* Implemented provisional support for PEP 728 (support for extra items within TypedDicts). You must set enableExperimentalFeatures to true for now.
* Added support for concatenated strings used in a `deprecated` decorator.
* Added support for call-site return type inference for class and instance methods.
* Improved handling of `enum.nonmember` in cases where the attribute has a declared type.
* Added missing check for inappropriate use of `InitVar` outside of a dataclass.

Behavior Changes:
* Added special-case handling for 'typing_extensions' module whose stubs are part of typeshed's stdlib stubs even though it is not part of stdlib.
* Refined the heuristic for when to use bidirectional type inference for the RHS of `and` and `or` operators.
* Changed behavior of command-line "--pythonversion" and "--pythonplatform" options so they now override the same-named options in the config file.

Bug Fixes:
* Fixed a bug that resulted in a false negative when attempting to use `TypedDict` or `Protocol` as an upper bound when using PEP 695 syntax.
* Fixed a bug that resulted in "reportUnnecessaryTypeIgnoreComment" diagnostics to be generated even if the source file was in the "ignore" list.
* Fixed a bug that leads to incorrect type inference for a lambda when passed to a constructor in certain circumstances.
* Fixed a bug that leads to a false positive type violation when reassigning a value within a loop and the target variable has a declared type of a constrained type variable.
* Fixed a bug that results in a false negative when passing an unpacked dict of the wrong type to a function that contains a positional-only parameter marker plus one or more keyword parameters.
* Fixed a bug in the import resolver that resulted in an incorrect resolution when an import within a `__init__.py` file uses the form `from .a import a`.
* Fixed a bug that results in a false positive error when an `await` expression is passed as an argument to an overloaded function.
* Fixed a bug that results in an incorrect "Unbound" type evaluation for a variable assigned within a loop.

Page 7 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.