Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 57 of 81

1.1.58

Enhancement: Rework signature help to use new VS Code / LSP APIs. Function overrides and active parameters are handled much, much better.

Enhancement: Added strict-mode check for declared return types in type stubs, which don't allow for return type inference.

Bug Fix: Fixed bug in type checker that resulted in a crash when a function declaration referred to itself within its return type annotation.

Bug Fix: Fixed bug that caused duplicate diagnostics to be reported for quoted type annotations in some cases.

Bug Fix: Fixed bug that caused "find all references" and "replace symbol" to sometimes miss references to a symbol if they were within quoted type annotations or type comments.

Bug Fix: Fixed bugs in a few of the "find all references" tests, which were not properly quoting a forward-declared symbol.

Bug Fix: Fixed a bug that caused infinite recursion and a crash when printing the type of a function that refers to itself within its own return type annotation.

Bug Fix: Fixed bug where an f-string expression generated an error if it ended in an equal sign followed by whitespace. The Python 3.8 spec doesn't indicate whether whitespace is allowed here, but clearly the interpreter accepts it.

Bug Fix: Fixed bug in logic that handles chained comparisons (e.g. "a < b < c"). The code was not properly handling the case where the left expression was parenthesized (e.g. "(a < b) < c").

Enhancement: Improved bidirectional type inference in the case where the type and the expected type are generic but the expected type is a base class that has been specialized. For example, if the expected type is `Mapping[str, int]` and the type is a `dict`.

1.1.57

Bug Fix: Fixed bug that caused partial type stub creation (for subpackages of a top-level package) to be generated in the wrong directory.

Change in Behavior: Changed logic within type evaluator to track differences between None and NoneType. Previously, they were treated interchangeably. This worked in most cases, but there are some edge cases where the difference is important.

Change in Behavior: Changed logic that converts a type to text so it properly distinguishes between "None" and "NoneType". It previously always output "None".

Enhancement: Added support for "NoneType" matching a type expression "Type[T]" during TypeVar matching.

Bug Fix: Fixed the handling of class or instance variable declarations that redefine a same-named symbol in an outer scope but do not use a variable declaration statement within the class.

Bug Fix: Updated type checker's logic for dealing with symbols that are declared in an inner scope and an outer scope but used within the inner scope prior to being redefined.

Bug Fix: Fixed bug a homogeneous tuple of indeterminate length was indexed with a constant expression.

Enhancement: Made the reportIncompatibleMethodOverride rule smarter. It now properly handles position-only parameters and allows a subclass to extend the signature of a method it is overriding as long as the parameters are *varg, **kwarg, or have default values.

Enhancement: Augmented the reportIncompatibleMethodOverride diagnostic rule to check for cases where a non-function symbol within a subclass redefines a function symbol in a base class.

New Feature: Added new diagnostic rule "reportIncompatibleVariableOverride" which is similar to "reportIncompatibleMethodOverride" except that it reports incompatible overrides of variables (non-methods).

1.1.56

Bug Fix: Fixed bug that caused the default python platform not to be specified if there was no config file and no python interpreter selected.

Bug Fix: Fixed crash in type checker that occurs when removing NoReturn from a union and having no remaining types.

Bug Fix: Fixed bug that caused `__name__` not to be flagged as an invalid attribute on a class instance.

Bug Fix: Fixed bug that caused quoted type annotation (i.e. a forward reference) that contains type arguments to report an "unbound symbol".

Enhancement: Improved CompletionItemKind for intrinsic class symbols like `__name__`, etc.

Bug Fix: Fixed bug in parsing of unicode named character encodings within string literals when the encoding included capital letters.

Bug Fix: Fixed bug whereby a non-function definition (such as an instance variable) within a subclass was not considered as having overridden an abstract method or property within a base class.

Change in Behavior: Changed Never internal type to be assignable to any type. Previously, it was assignable to no type.

Bug Fix: Fixed bug that caused a spurious error during TypeVar matching when the TypeVar is constrained and is initially matched against an Any or Unknown type but is later matched against a known type.

Bug Fix: Fixed bug in dataclass logic that reported spurious error when initializing attribute with `field(init=False)`.

Change in Behavior: Renamed ParameterSpecification to ParamSpec to reflect latest PEP 612 changes.

Enhancement: Updated typeshed fallback stubs to latest version.

Change in Behavior: Updated PEP 612 and 614 features to be dependent on 3.10 rather than 3.9.

Bug Fix: Fixed bug that caused diagnostics to persist in files that are not part of the workspace even after they are closed.

Bug Fix: Fixed bug that generated incorrect type checking error when type alias used a Type[x] type annotation.

1.1.55

Bug Fix: Changed logic for reportMissingModuleSource diagnostic rule so it isn't reported for stub files.

Enhancement: Added support for typing.OrderedDict, which is a generic alias for collections.OrderedDict.

Enhancement: Added support for new Python extension callback so Pyright extension is notified when pythonPath is modified.

Bug Fix: Fixed bug in docstring trimming code that resulted in some docstrings (those consisting of two lines where the second line was empty) not appearing when hovering over functions.

Bug Fix: Fixed bug in type checker that resulted in incorrect error when creating a generic type alias with a compatible TypeVar as one of the type arguments.

Bug Fix: Fixed bug that caused value expressions for default parameter values in lambdas to be evaluated within the wrong scope resulting in errors if the lambda scope had a same-named symbol.

Bug Fix: Fixed bugs in handling of wildcard imports. First, it was not properly handling the implicit introduction of symbol A in the statement "from .A import *". Second, it was implicitly including submodules as part of the wildcard, and it shouldn't.

Bug Fix: Fixed bug that resulted in incorrect error when using an unpack operator in an argument expression that corresponds to a *varg parameter in the callee.

Bug Fix: Fixed recent regression that caused 'isinstance' check to emit a bad error when 'self.__class__' was passed as a second argument.

1.1.54

Enhancement: Added json schema for mspythonconfig.json (in addition to pyrightconfig.json).

Enhancement: Updated config file watcher logic so it can detect when a new config file is added to a workspace.

Bug Fix: "Find all references" should not return references to a symbol within library code unless that library source file is currently open in the editor.

Bug Fix: Fixed bug in type checker that caused a crash when analyzing an abstract class with a constructor that contained two or more parameters, all of which are unannotated.

Bug Fix: Fixed pyrightconfig.json JSON schema to accept "information" as a valid diagnostic severity setting.

Enhancement: Updated log levels for messages logged by the Pyright service. Some log levels were "info" but should have been "warning" or "error".

Bug Fix: Fixed bug that caused incorrect type evaluation for *args or **kwargs parameters if no type annotation was present. This bug also affected completion suggestions for these parameters.

Bug Fix: Fixed a bug that resulted in Pyright attempting to parse and analyze binaries (native libraries) like ".pyd" and ".so" files.

Bug Fix: Fixed bug in argument/parameter matching when an unpack operator is used in the argument and the parameter is a *varg type.

Enhancement: Renamed setting "pyright.useLibraryCodeForTypes" to "python.analysis.useLibraryCodeForTypes" for compatibility with Pylance. The older setting name is still supported but will be removed in the future.

Enhancement: Added code to handle the case where a class is assigned to a type described by a callable protocol object. In this case, the class constructor's signature should be compared against the `__call__` signature defined in the protocol.

Bug Fix: Fixed bug in import resolver that caused imports that referred to local namespace packages not to resolve.

Bug Fix: Fixed bug that caused enum names that were not uppercase to be handled incorrectly.

Bug Fix: Fixed bug that caused incorrect type analysis when a package `__init__.py` imported and re-exported a symbol that matched the submodule it was being imported from, e.g. `from .foo import foo`.

Bug Fix: Fixed bug in type analyzer where default value expressions for lambda parameters were not being evaluated. This meant that errors related to these expressions were not reported, and symbols referenced within them were marked as unreferenced.

1.1.53

Bug Fix: Fixed bug in parser where it was emitting a spurious error about function return type annotations being a tuple when it was simply enclosed in parentheses.

Bug Fix: Fixed a bug that caused completion suggestions not to work for the LHS of a member access expression (e.g. the "a" in "a.b").

Bug Fix: Fixed diagnostic message for "partially unknown" types (used in strict mode). It was incorrectly using the "unknown" message rather than "partially unknown", which could lead to confusion.

Enhancement: Changed type printing logic to emit "Unknown" annotations when in strict mode to make it clearer to the user which part of the type is unknown.

Bug Fix: Fixed bug that caused extension to report empty diagnostics for all tracked files when unnecessary (in particular, when the diagnostic mode is set to openFilesOnly and the file is not open).

Enhancement: Added partial support for mypy-supported variant of " type: ignore" comment where specific error codes in square brackets after the "ignore". Pyright doesn't honor the specific error codes but now treats it as a normal type: ignore" comment.

Bug Fix: Fixed bug that caused the arguments of a call to remain unanalyzed if the LHS of the call was not callable. This resulted in omitted errors and spurious unreferenced symbols.

Bug Fix: Changed diagnostic for second argument to "Enum" call to be dependent on the reportGenalTypeIssues diagnostic rule rather than unconditional.

Bug Fix: Fixed recent regression relating to "isinstance" type narrowing when the type of the target is a constrained TypeVar.

Bug Fix: Fixed bug in the handling of the NewType function introduced in PEP 484. The previous code was not synthesizing a constructor (`__init__` method) as specified in the PEP.

Enhancement: Changed fallback mechanism for detecting the configured python interpreter to use the shell command "python3" first and then "python" if that fails. This is preferable on Linux and MacOS because "python" typically points to a Python 2.7 interpreter.

Enhancement: Added parser error for relative imports of the form "import .abc". This is treated as a syntax error by the Python interpreter and should be flagged as such.

Bug Fix: Fixed bug with "from . import a" form of import. Diagnostic was not logged when "a" could not be resolved.

Page 57 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.