Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 48 of 81

1.1.113

Bug Fixes: Improved support for PEP 634 (Structured Pattern Matching):
* Improved negative-case type narrowing for capture patterns. Because capture patterns capture anything, the remaining type is "Never".
* Improved type narrowing for mapping patterns used in structural pattern matching when the subject expression type contains a typed dictionary.
* Added code to detect and report cases where irrefutable patterns are used within an "or" pattern and are not the last entry.
* Added logic to verify that all "or" subpatterns target the same names as specified in PEP 634.
* Added code to detect the case where a case statement without a guard expression uses an irrefutable pattern but is not the final case statement. This is disallowed according to PEP 634.
* Fixed bug in parser that resulted in incorrect text ranges for parenthetical patterns.

Bug Fix: Improved performance for completion suggestions, especially when large numbers of suggestions are returned.

Enhancement: Updated typeshed stubs to the latest.

Enhancement: Enabled postponed type annotation evaluation by default for Python 3.10.

Bug Fix: Fixed bug that caused a false positive when a bound TypeVar was used to access a class method that was annotated with a bound TypeVar for the "cls" parameter.

Bug Fix: Fixed bug that caused index expressions to be printed incorrectly when they appeared in error messages.

Enhancement: Added type narrowing support for index expressions that use a numeric (integral) literal subscript value.

Enhancement: Improved the logic that determines whether a call expression within the code flow graph is a "NoReturn" call. It now provides better handling of unions when evaluating the call type.

Enhancement: Added support for parenthesized list of context managers in "with" statement for Python 3.10.

Bug Fix: Fixed bug that prevented the use of a generic type alias defined using a PEP 593-style "Annotated" with a bare TypeVar.

1.1.112

Bug Fix: Fixed false negative when PEP 585 type is used in a type alias or other cases where postponed evaluation is not possible.

Bug Fix: Fixed regression that resulted in error when "match" is used in expressions but is mistaken for a pattern-matching statement.

Bug Fix: Fixed schema for "python.analysis.logLevel" setting. The default value was specified incorrectly. Thanks to Rafał Chłodnicki for this fix.

Bug Fix: Fixed a bug that caused a false positive when a TypeVar is bound to a generic protocol class.

Bug Fix: Fixed a bug that caused a false positive when a boolean operator was applied to a type variable and the corresponding magic method used an explicit type annotation for the "self" parameter.

Enhancement: Added a new diagnostic check for out-of-range indexes for tuples that have known lengths.

Enhancement: Added limited support for negative type narrowing in pattern matching. For example, if the type of the subject expression is bool and the matching pattern is `False | x`, the type of `x` will be inferred to be `True`.

Bug Fix: Fixed bug that affected generic type aliases that contained Callable types that are parameterized by a type variable.

Enhancement: Extended abstract method checks to Protocol classes even though they don't explicitly derive from ABCMeta.

Bug Fix: Fixed bug in type narrowing for class patterns in "case" statements.

1.1.111

New Feature: Implemented PEP 634 support for structural pattern matching. This new PEP was just accepted, and the functionality will appear in the next alpha release of Python 3.10.

Bug Fix: Fixed bug that caused a false positive error when declaring a class within a local scope when the symbol is nonlocal or global.

Enhancement: Improved handling of unpacked arguments when the type is a union of known-length tuples.

1.1.110

Bug Fix: Fixed a bug in isinstance type narrowing logic where the type of the second argument to isinstance is type `Type[T]` and the first argument is a union of types that includes type `T`.

Enhancement: Expanded reportUnusedCallResult diagnostic check to also check for expressions of the form await <call expression>.

Bug Fix (from Pylance): Changed language server to set the working directory before attempting to execute script to retrieve sys.paths.

Behavior Change (from Pylance): Separated behavior of "go to definition" and "got to declaration". The former tries to take you to the source, whereas the latter takes you to the stub file.

Bug Fix: Changed binding logic to not assume that an assignment to a simple name can generate an exception. This fixes a reported false positive error in a type narrowing case.

Enhancement: Added proper error check for the use of an unpack operator (*) when used outside of a tuple.

Bug Fix: Avoid generating a diagnostic for reporUnknownMemberType if the member access expression is used as a call argument and is a generic class that is missing type arguments. This case was already special-cased for reportUnknownArgumentType to handle common cases like `isinstance(x, list)`, but it was resulting in errors for `isinstance(x, re.Pattern)`.

Bug Fix: Fixed a hole in the detection of unspecified type arguments for the Tuple and tuple classes.

Enhancement: Added support for generic classes that are parameterized by ParamSpecs, as allowed in PEP 612.

1.1.109

Enhancement: Added some performance optimizations to handle cases where there are many overloads for a function (>100). Previous code hit n^2 analysis times where n is number of overloads.

Enhancement: Added perf optimization that avoids reallocation of special form classes (like Protocol and Literal) every time they're used. Since instance of the type is now cached and reused.

Enhancement (from Pylance): Improved formatting of docstrings in hover text, completion suggestions, and signature help.

Enhancement (from Pylance): Added better performance metrics.

Bug Fix (from Pylance): Improved logic to ignore temp files created by code formatters like black.

Bug Fix: Fixed "possibly unbound" false positive error in try/except/else/finally statement in the special case where a "bare except" clause is used.

Bug Fix: Replaced logic that detects whether a function's inferred type is "NoReturn" — and specifically whether its implementation is a "raise NotImplementedError". The old logic depended results that varied depending on the order in which types were evaluated and was therefore nondeterministic.

Bug Fix: Fixed false negative where type expressions used as arguments to TypedDict or NamedTuple constructors are not correctly checked for incompatibility with older versions of Python when they contain `|` or use PEP 585 types.

Behavior Change: Changed PEP 585 violations (e.g. using `list[int]` rather than `List[int]`) to be unconditional errors rather than diagnostics controlled by reportGeneralTypeIssues diagnostic rule. That way, they appear even when type checking is disabled.

Bug Fix: Reverted recent change in for/else statement logic because it introduced a regression.

Behavior Change: Changed the `reportUnboundVariable` default severity from "warning" to "none" when typeCheckingMode is "off". There were too many complaints of false positives from users who have no interest in type checking.

Enhancement: When a redundant form of a from .. import statement is used (e.g. `from x import foo as foo`), always mark the imported symbol as accessed because it is assumed that it is being re-exported.

Bug Fix: Fixed bug that caused incorrect type evaluation when a return type in a generic function used a Callable with Concatenate and a ParamSpec.

Bug Fix: Fixed bug in code that prints types (e.g. in error messages and hover text) that resulted in duplicate types in a union when typeCheckingMode was "off".

Enhancement: Updated code that prints function types (e.g. for error messages and hover text) to include unioned return types in parentheses to distinguish between `() -> (int | str)` and `() -> int | str`.

Bug Fix: Fixed formatting of usage text in CLI. Fix contributed by fannheyward.

Bug Fix: Fixed bug that caused problems when the type `ellipsis` was used in a type stub instead of `...`.

Bug Fix: Fixed recent regression in handling of isinstance second parameter.

1.1.108

Behavior change: Changed type inference logic for binary expressions of the form `x or []` so `[]` uses the type of `x` to inform its type.

Bug Fix: Fixed bug in the way a specialized variadic type alias is printed (for error messages, hover text, etc.).

Enhancement: Added support for subscript index lists that contain a trailing comma (e.g. `a[0,]`). The subscript in this case is a tuple and is not valid for most objects, so it should generate an error.

Enhancement: Improved parse error recovery for empty subscripts (e.g. `a[]`). Started to add support for PEP 637.

Enhancement: Improved consistency of error messages.

New Feature: Added support for PEP 637 (keyword and unpacked arguments in subscripts). This PEP is still in the draft phase and may change before being finalized.

New Feature: Added a way for the "verifytypes" feature to ignore partially-unknown types imported from external packages. To use this feature, append a "!" to the end of the package name provided after the "--verifytypes" option.

Page 48 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.