Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 9 of 81

1.1.345

Bug Fixes:
* Fixed bug that led to false negative when a list expression was used within the first type argument of an `Annotated` type expression.
* Added a missing error condition for a non-method function that is marked `final`.
* Fixed crash related to a regression introduced with recent internal URI tracking.
* Fixed false negative for a `TypeVarTuple` constructor call that includes value constraints.
* Fixed a bug that led to an incorrect type evaluation for an explicitly-specialized class parameterized with a ParamSpec.
* Fixed bug that resulted in incorrect type evaluation when a PEP-695 TypeVar is shadowed by an identifier of the same name within an inner scope.
* Added missing check for inconsistent use of `final` in an overloaded function. Added missing check for override of an overloaded method marked `final`.
* Fixed bug in protocol matching logic to reject a protocol match if a variable is a `ClassVar` in the protocol but not in the concrete class (or vice versa).
* Fixed bug that leads to a false positive when a generic property is defined within a protocol.
* Fixed a bug that led to incorrect type evaluation when a constrained TypeVar includes literal types as constraints.
* Added missing check for the specialization of a generic type alias that includes a TypeVarTuple plus two or more TypeVars.
* Fixed a bug that resulted in a false negative when specializing a generic type alias parameterized by a regular TypeVar with an unpacked tuple.
* Added missing error for an illegal unpacked argument in type argument list.
* Fixed a bug that led to a duplicate error message when defining a class-scoped type alias.

Enhancements:
* Improved error message for protocol classes that derive from non-protocol classes.
* Improved error reporting for incompatible overrides.
* Added code to report when the `Concatentate` special form is used in an illegal context.
* Added support for constants for field names in `NamedTuple` call.
* Improved evaluation logic for tuple slices. It now works in cases where the tuple includes unbounded entries or unpacked TypeVarTuples.
* Improved type analysis performance in certain cases involving complex code flow graphs and "truthy" conditional statements.
* Added check for a call to an unimplemented method in a protocol from a base class that explicitly calls it.
* Implemented small performance improvement by not generating error messages during protocol TypeVar variance validation.
* Added check for data protocols used in an `issubclass` call. PEP 544 indicates that this isn't allowed.
* Added check for "unsafe overlaps" for a runtime-checkable protocol when used in an `issubclass` or `isinstance` check.

Behavior Changes:
* Changed CLI to sort diagnostics by location within a file.
* Removed support for `Union[*Ts]` and `Union[*tuple[...]]`. This functionality was included in an early draft of PEP 646 but was dropped in the final spec. The functionality can still be used in pyright if `useExperimentalFeatures` is set to true, but it will likely be removed entirely in the future.

1.1.344

Bug Fixes:
* Fixed bug that caused "go to definition" and semantic rename to not work for forward-declared symbols referenced in a "type" type alias definition.
* Fixed bug in parser that resulted in an incorrect syntax error when certain expression forms were used with the `type` statement to define a type alias.
* Fixed a bug that resulted in a false negative when attempting to access valid attributes from a type alias created via a call to the `TypeAliasType` constructor.
* Fixed a bug that led to an incorrect type evaluation when explicitly specializing a generic class or type alias with a ParamSpec.
* Fixed a bug that led to a false positive "not awaitable" error if the `__await__` method return type was Unknown.
* Fixed a bug that results in a false negative when the `TypeAliasType` constructor is called with an expression that refers to a traditional TypeVar.
* Fixed a bug that leads to a false negative when validating type compatibility between two callables and the source has a position-only parameter corresponding to a non-position-only parameter in the dest.
* Fixed bug in code flow analysis that resulted in an incorrect type evaluation when a "NoReturn" call is made within a code block protected by an exception-suppressing context manager.

Behavior Changes:
* Added LSP exemption for `__post_init__` method.
* Improved overload overlap logic to detect partial overlaps when parameter types include unions that intersect.

Enhancements:
* Improved logic that determines whether the expression used for a `type` statement or a call to `TypeAliasType` is a valid type expression.
* Added additional checks for invalid `NewType` calls.
* Improved detection of invalid type alias expressions for implicit (traditional) type aliases.
* Improved error reporting for `with` statement when `__enter__` or `__aenter__` is present but cannot be bound.

1.1.343

Bug Fixes:
* Fixed bug that resulted in crash when using language server APIs in certain circumstances.
* Fixed bug that resulted in incorrect type evaluation of a variable within a loop under certain conditions.
* Fixed a bug in the function type assignment logic that leads to a false positive under certain circumstances involving a ParamSpec in an overload with a callback that includes a positional-only parameter separator.
* Fixed a bug that leads to a false negative when `Self` is used within a class definition statement. PEP 637 explicitly rejects this usage of `Self`.
* Fixed a bug that leads to a false negative when `Self` is used within a metaclass. PEP 637 explicitly rejects this usage of `Self`.

Enhancements:
* Eliminated some unnecessary work when determining the effective type of a symbol that doesn't have a declared type. When evaluated in the context of a particular usage, it's unnecessary to evaluate any assignments within the same execution scope.
* Add error checking for illegal use of unary, binary, or ternary operators within a type annotation.
* Added detection of invalid keyword arguments in `TypedDict` class definition when using the normal class syntax.
* Added detection of a call to `TypedDict` alternative syntax form that assigns the resulting class to a variable whose name doesn't match the name specified in the `TypedDict` call.
* Added check for the use of a TypedDict class in an `isinstance` or `issubclass` call. These generate a runtime exception.

1.1.342

Bug Fixes:
* Fixed `deprecated` functionality that was broken by a recent change to the typeshed stubs (which replaced a function with a class).
* Fixed bug that results in a false positive error under certain circumstances when calling an inner function that uses a ParamSpec defined scoped to an outer function.
* Fixed a bug in the `--verifytypes` CLI feature that resulted in a false negative when docstrings are missing from a class or function that is defined in a private module but re-exported from a public module.
* Fixed a bug that led to a combinatoric explosion and an infinite loop in certain edge cases involving a class with an untyped constructor and methods that return recursive types.
* Fixed a bug that led to false negative errors when doing protocol matching with a method that uses `Self` in its signature.
* Increased internal limit of the number of overload signatures that can be captured by a ParamSpec from 64 to 1024.
* Fixed a bug that leads to infinite recursion (stack overflow) under certain circumstances.

Enhancements:
* Added narrowing support for literal patterns in a `match` statement that are used to discriminate between tagged unions of objects that can be discriminated based on a field with a literal type.

1.1.341

Normally, new pyright releases are published each Tuesday. This is an out-of-cycle release that addresses several regressions introduced in 1.1.340. These were all related to a massive change (one that affected a majority of the source files in pyright) that changed the way that file paths were tracked internally. Pyright now uses URIs rather than simple paths — a change that's needed to support a number of language server features.

Bug Fixes:
* Fixed regression introduced in 1.1.340 that caused a crash in the `--verifytypes` functionality.
* Fixed regression introduced in 1.1.340 that resulted in an incorrect URI returned as part of a language server "rename" request.
* Fixed regression introduced in 1.1.340 that resulted in an unintended schema change for the `outputjson` output.
* Fixed regression introduced in 1.1.340 that resulted in a crash when using file watchers (`--watch` option).
* Fixed regression introduced in 1.1.340 that resulted in incorrect import resolution for certain namespace packages.
* Fixed bug that resulted in a false positive error when one ParamSpec was captured by another ParamSpec.
* Fixed bug related to function type compatibility when the dest type contains an unpacked tuple followed by one or more positional-only parameters as in `Callable[[*Ts, int], None]`.

Enhancements:
* Improved signature help provider so it handles overloaded `__init__` and `__new__` methods when calling a constructor.
* Updated typeshed stubs to the latest version.

1.1.340

Bug Fixes:
* Fixed English text for position-only error. It contained an extraneous `\"` at the end.
* Fixed a bug that resulted in a crash under certain circumstances when defining a type alias using a `type` statement when no type parameters are defined.
* Fixed bug in narrowing logic for sequence pattern magic where special cases of `str`, `bytes`, and `bytearray` were not handled correctly.
* Fixed bug that led to a false positive when a zero-argument form of `super` is called within an inner function or lambda.
* Fixed a bug that led to a false positive error in certain cases involving a union of two callables.
* Removed implicit `__qualname__` attribute from the module namespace. It doesn't exist at runtime, so this was leading to a false negative.
* Fixed bug that led to a false positive when a tuple of indeterminate length was used in a callback function.
* Fixed a bug that led to an improper "unbound" type evaluation under certain circumstances in a `finally` clause.
* Fixed bug that results in an extraneous `}` character in stub output.
* Fixed bug that led to incorrect return type inference for a generator that always raises an exception rather than returning.
* Fixed package manifest so default values of configurations are properly reflected.

Behavior Changes:
* (From pylance) All paths are now internally tracked as URIs. This provides better support for files that are not stored within a file system. This should be transparent to most pyright users.
* Previously, return type inference was disabled for all functions when `analyzeUnannotatedFunctions` was set to false regardless of whether the function had input type annotations. Return type inference is now enabled if the function is partially annotated.

Enhancements:
* Improved error message for `set` invariance type violations.
* Added support for the `warning.deprecated` (PEP 702) functionality when an overloaded function implementation is marked deprecated and then used outside of a call expression.
* Enhanced type narrowing logic for sequence pattern matching to support narrowing of tuple subject types based on sequence subpatterns.
* Extended support for "partially unbound" variable detection to cases that involve comprehension and class scopes.
* Eliminated the limitation that unpack operators, `await` operators, assignment expressions (walrus operators), f-strings, chained strings, and strings with escape characters cannot be used within `Annotated` expressions when using an alias of `Annotated`.

Page 9 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.