Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 46 of 81

1.1.125

Bug Fix: Disabled the "always False comparison" check for expressions like "sys.platform == 'win32'" because they can vary depending on environment.

Enhancement: Added error check for a class that attempts to derive from NamedTuple and other base classes. This is not supported and will generate runtime exceptions.

Enhancement: Improved type checking for generators. Fixed several false negatives and false positives relating to "yield from" expressions.

Enhancement: Changed special-case logic for `self` annotations used with `__init__` methods to accommodate new usages in typeshed stubs.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed bug in TypeVar constraint solver that resulted in a false positive when using the built-in "filter" method with the "os.path.exists" callback.

Bug Fix: Fixed bug where "comparison chaining" was not being appropriately applied to expressions that contained "is", "is not", "in" and "not in" operators in a chain (e.g. "1" in "1" == "1").

Enhancement: Added smarter handling of empty lists (`[]`) and dicts (`{}`). Previously, these were inferred to have types `list[Unknown]` and `dict[Unknown, Unknown]`, respectively. They are now provided with a known type if the variable is assigned a known list or dict type along another code path.

Bug Fix (from pylance): Made hover text, signature help, and completion suggestions show function docstring using same code.

Bug Fix (from pylance): Fixed issue with partial stub files in cases where a stub file is found but no corresponding source (.py) file is found.

1.1.124

Bug Fix: Fixed bug where a keyword parameter with a generic type (a TypeVar) and a default value of "..." caused the TypeVar to be assigned a value of "Any".

Bug Fix: Fixed recent regression that caused certain diagnostics to be suppressed when calling a constructor with an expected type.

Enhancement: Added missing check indicated in PEP 589 for TypedDict fields that override a parent class field by the same name with a different type.

Bug Fix: Added support for TypeVar where the bound or constrained types are literals.

Behavior Change: Changed "stubPath is not a valid directory" logging from an error to a warning. The fact that the value defaults to "typings" and most users don't have a typings folder results in confusion, so a warning is more appropriate here.

Enhancement: Updated typeshed stubs.

Bug Fix: Fixed bug that resulted in false negatives when a generic class was used within a subscript (e.g. within the type argument of another type) and no type arguments were specified for the generic class. This also resulted in such types not properly getting default values. For example, in the expression `Union[int, Callable]`, the `Callable` was not being interpreted as `Callable[..., Unknown]`.

Enhancement: Improved error message for partially-unknown lambda type.

Bug Fix: Fixed a bug in the logic for inferring the type of list expressions when the expected type is "object".

Bug Fix: Improved handling of bidirectional inference for call expressions when the expected type contains a union of literals and the function returns a generic type.

Enhancement: Added new check for a common source of bugs where an equals operator within an if statement compares two values whose literal types do not overlap and will therefore never evaluate to True.

1.1.123

Bug Fix: Fixed bug in handling of "Final" type annotation with no specified type argument (e.g. "x: Final = 4").

Enhancement: Added support for inferring type of subscripted tuple when subscript is a negative integer literal.

Bug Fix: Fixed recent regression where `super(A, self).x` did not return an unknown type if class `A` had a class in its MRO that had an unknown type.

Bug Fix: Allow lowercase `tuple` type to be subscripted in versions of Python prior to 3.9 if it is within a quoted annotation.

Bug Fix: Fixed false positive error due to constraint solver's handling of a TypeVar used within a Callable parameter that is matched to a function parameter annotated with another TypeVar.

Enhancement: Improved handling of literals within constraint solver when used with bidirectional type inference.

Bug Fix: Fixed bug that caused false positive error when a generic call expression was used for an argument to an overloaded function and TypeVar matching errors were reported.

Enhancement: Deferred resolution of metaclass during class type resolution to improve compatibility with code generated by mypy-protobuf, which contains cyclical dependencies.

Bug Fix: Fixed bug in declaration provider that caused declaration of class variables to not be resolved correctly when accessed via a `cls` parameter in a class method.

Bug Fix: Fixed bug in symbol resolution when a local class mirrors the name of a class in typing (e.g. `List`) but is not imported from typing and is used in a context where it is forward declared without quotes.

Bug Fix (from pylance): Avoid recursing infinitely when searching for source files when there is a cyclical symlink present.

Bug Fix: Fixed type inference for "yield" expressions. The previous code was using the same logic for "yield" and "yield from".

Enhancement: Added check to determine if type variables in generic protocols use the appropriate variance.

Performance Improvement: Limited "implied else type narrowing" to expressions that have declared types. It's too expensive to infer types.

1.1.122

Bug Fix: Fixed false positive error in constructor method with an input parameter annotated with a class-scoped TypeVar and with a default value.

Enhancement: Improved performance of type analysis for certain code patterns that involve inferred types of variables that are used in deeply nested loops and chains of updates. In one such example, this change reduced the analysis time from ~17000ms to ~200ms.

Bug Fix: Fixed bug in the handling of the `owner` parameter for the `__get__` method in a descriptor class. The type evaluator was using an `Any` type rather than the proper class type in this case.

Bug Fix: Updated TypeVar constraint solver so it tracks a "narrow bound" and "wide bound" for each TypeVar as they are being solved. This fixes several subtle bugs.

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: Added new top-level "extraPaths" config option for pythonconfig.json that specifies the default extraPaths to use when no execution environments apply to a file. Changed settings logic to use the new default extraPaths mechanism for the "python.analysis.extraPaths" setting.

Bug Fix: Fixed bug related to the handling of `from . import X` statement located in a file other than `__init__.py`. When used outside of an `__init__.py` file, this import looks for the `__init__.py` and imports the requested symbol `X` from it rather than looking for a submodule `X`.

Enhancement: Improved completion provider's handling of method overrides so it properly handles properties.

Enhancement (from pylance): Add lowercased items from `__all__` in auto-imports.

Bug Fix: Fixed bug in constraint solver that occurs when a constrained TypeVar is used in conjunction with a protocol that has a contravariant TypeVar.

1.1.121

Bug Fix: Fixed a bug that generated a false positive error when a function (or other callable) was assigned to a Hashable protocol.

Enhancement (from pylance): Made auto-imports lazy for better completion suggestion performance.

Enhancement (from pylance): Improved readability of hover text for functions and methods with overloaded signatures.

Bug Fix: Fixed false positive error when using an instance or class variable defined within a Protocol class within a method in that same class. The previous logic was based on a misinterpretation of a sentence in PEP 544.

Bug Fix: Fixed false positive error in type checker when dealing with two types that are both unions and both contain constrained type variables.

Bug Fix: Fixed improper handling of symlinks used in editable installs. This affected auto-import functionality.

Bug Fix: Fixed recent regression that caused crash in hover provider.

Bug Fix (from pylance): Fixed issue that caused editable installs to require a restart of the language server before their effects were visible.

Bug Fix: Fixed false positive error during TypeVar constraint solving in the case where the same TypeVar is used in both the form T and Type[T] in the same signature.

Enhancement: Improved support for enums. The Python spec indicates that attributes that start and end with an underscore are not treated as enum members, nor are attributes that are assigned a descriptor object.

Enhancement: Added support for inferring the "value" and "name" fields of an enum.

Bug Fix: Added support for unparenthesized pattern subject lists in match statement.

Bug Fix: Fixed false positive error related to a type alias declared within a class.

1.1.120

Bug Fix: Fixed type evaluation bug that resulted in the incorrect inference of an exception type within an "except X as Y" clause when the expression X was a bound TypeVar.

Enhancement: Improved detection and error reporting for class definitions that depend on themselves (illegal cyclical dependency). Previously, pyright failed in ways that were difficult to diagnose.

Enhancement: Added support for symbolic links in import resolver both for resolution of ".pth" files and for imports themselves.

Behavior Change: Removed support for "venv" entry in execution environments since this never really worked. Clarified in documentation that import resolution within an execution environment is not transitive.

Bug Fix: Fixed bug in completion provider that caused class variables not be included as suggestions as members for the "cls" parameter in a class method.

Enhancement: Added error check for access to non-required fields in a TypedDict using a subscript with a literal string field name. Added support for "narrowing" of a TypedDict class based on guard expression of the form "S in D" where S is a string literal name of a non-required field. Improved the synthesized "get" method on a TypedDict for non-required fields; it now returns an Optional[T] (where T is the defined type for that field) rather than just T.

Enhancement: Updated to the latest typeshed stubs.

Enhancement: Added error check for a "yield" or "yield from" statement used within a list comprehension. This generates a runtime syntax error.

Bug Fix: Fixed bug in type inference for value returned by a "yield" or "yield from" statement.

Page 46 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.