Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 56 of 81

1.1.64

Bug Fix: Fixed regression that caused "isinstance(x, Callable)" to be flagged as an error when PEP 484 says that it's legal.

Enhancement: Changed error messages related to "partially unknown" types to expand type aliases, which can obscure the unknown part of the type.

Enhancement: Added support for narrowing types based on the pattern "A.B == <literal>" and "A.B != <literal>" when A has a union type and all members of the union have a field "B" with a declared literal type that discriminates one sub-type from another.

Enhancement: Added bidirectional type inference for ternary expressions.

Bug Fix: Fixed incorrect handling of member accesses when the accessed field had a type that was a union between two or more classes, some with special accessor methods (e.g. "__get__") and some without.

Enhancement: Improved type checking for assignments of callable types. Previously, certain edge cases were ignored.

Enhancement: Added code to check for overlapping (obscured) overload functions.

Bug Fix: Fixed bug that caused incorrect evaluation of type alias that refers to Literal types. The literal values were being stripped in some cases.

Bug Fix: Fixed recent regression that caused type aliases that described literal types to be printed incorrectly in hover text and error messages.

Enhancement: Added code to report overloads that overlap in an "unsafe" way — i.e. they can potentially accept the same arguments but return different (incompatible) types.

Enhancement: Updated typeshed stubs to latest version.

Bug Fix: Fixed bug in assignment checks between homogeneous multi-length tuples and fixed-size tuples.

1.1.63

Enhancement: Diagnostic rule severity overrides are now editable in the VS Code settings UI.

Bug Fix: Fixed out-of-memory error that occurred during a workspace "find symbols" operation. We were not properly checking for the heap high watermark during this operation.

Enhancement: Added support for special type "Counter" exported by typing module, which is an alias for collections.Counter.

Bug Fix: Fixed bug in bidirectional type inference for dictionary statements. The logic was not allowing for dict subclass Mapping.

Enhancement: Improved type checker's handling of "in" operator. It previously flagged an error if the right operand didn't support a `__contains__` method. It now properly checks for iterable types as well.

Bug Fix: Fixed bug that caused incorrect evaluation of symbol types within a chain of assignments (e.g. "a = b = c = 4") in some cases.

Enhancement: Enabled file watcher for libraries to detect changes in installed packages. This behavior is already standard for Pylance, but it was disabled for Pyright.

Enhancement: Improved handling of Tuple type. The type checker now does a better job retaining the types of the individual elements within a Tuple or a class that derives from a Tuple.

Enhancement: Improved support for NamedTuple classes and classed derived from NamedTuple. The type checker now retains types of individual elements when used with unpacking and indexing operators.

Behavior Change: Changed "find workspace symbols" to return only symbols from within user code or opened files, not library files that are closed.

Bug Fix: Fixed recent regression that caused incorrect errors to be generated in sub files for certain call expressions.

New Feature: Added support for Concatenate as described in latest version of PEP 612. Added ParamSpec and Concatenate to typing.pyi.

1.1.62

Bug Fix: Fixed bug in the handling of unrecognized escape sequences within string literals.

Bug Fix: Fixed bug related to a subtle interaction between bidirectional type inference of list expressions that contain literal values and TypeVar matching. The previous logic was incorrectly matching T in List[T] and the list contained a literal type. It should have stripped the literal if possible.

Enhancement: Added diagnostic message for TypeVar with a single constraint type for consistency with mypy.

Enhancement: Added support for member access completion suggestions when the LHS is a function or a None type.

Behavior Change: Behavior change for type stub generator: don't emit `__all__` assignments or assignments to self.xxx in function bodies. These violate PEP 484 guidelines for type stubs.

Enhancement: Added diagnostic check to reportInvalidStubStatement that flags parameter default value expressions that are not "..." in stub files.

Bug Fix: Fixed bug that caused annotated types of vargs and kwargs parameters not to be printed in hover text.

Enhancement: Implemented support for older-style function annotation type comments. I previously resisted adding this additional complexity, but we're seeing many libraries that still contain these annotations for backward compatibility with Python 2.

Bug Fix: Fixed bug that caused a crash in the type analyzer when a protocol class referred to itself.

Enhancement: Added support for "useLibraryCodeForTypes" option in config file. It overrides the client setting of the same name or the "--lib" command-line option.

Bug Fix: Fixed several bugs in logging for config errors.

Enhancement: Added logic to type checker to validate that the "self" or "cls" parameter with a specified type annotation is assignable when binding the method to an object or class.

Enhancement: Improved type assignment diagnostic message. Added "(property)" designator to the end of a property type to differentiate it from a normal attribute.

Enhancement: Added code to validate that method overloads are all abstract or not.

Enhancement: Updated typeshed stubs to the latest.

1.1.61

Bug Fix: Fixed bug that caused symbols to be marked unaccessed if they were accessed by code that is not accessible (e.g. due to conditional execution based on the platform).

Bug Fix: Updated PEP 604 and PEP 612 error message to refer to Python 3.10 instead of 3.9.

Behavior Change: Changed logic that validates "self" or "cls" parameter names to ignore the check if the provided parameter name begins with an underscore, as is seen in several typeshed stub files.

Bug Fix: Fixed bug in nested f-string parsing when f-string contains triple quotes that include single quotes.

Bug Fix: Fixed handling of a class that is subclassed from both Enum and another class (like str).

Enhancement: Added support for generic classes that refer to themselves as type arguments within their base class.

Bug Fix: Improved error message for partially-unknown types that have a type alias.

Bug Fix: Allow use of forward-declared classes as subclass in class declarations within type stub files.

Bug Fix: Add special-case handling of `__class_getitem__` method, which acts as a class method even though it is not decorated as such.

Bug Fix: Added missing validation of arguments to `type` call.

Enhancement: Added `=` character to end of named parameter for completion suggestions within a call signature.

Bug Fix: Added client capability check for signature information "labelOffsetSupport" for compatibility with clients that don't support this capability.

Bug Fix: When adding completion suggestions to the list for expression completion, avoid adding duplicately-named symbols that appear in nested scopes.

Bug Fix: Fixed bug related to calls of methods on a metaclass via classes that are constructed by that metaclass.

Enhancement: Added check for single overload function with no additional overloads.

1.1.60

Bug Fix: Fixed a bug "aliased import with leading underscore produces private usage error".

Bug Fix: Fixed a bug that caused the wrong diagnostic message string to be used when "Generic" is used with no type arguments.

Enhancement: Added new diagnostic message for when "Generic" is used in contexts outside of a class definition statement.

Bug Fix (from Pylance): Use `sys.version_info` to query interpreter version.

Enhancement: Added heuristics to type var solver so it picks the "least complex" solution when considering the elements within a union.

Enhancement: Updated typeshed stubs to the latest versions.

Bug Fix: Fixed a bug that caused an error to be reported when a newline token was used within an f-string expression.

Enhancement: Added new diagnostic rule "reportInvalidStubStatement" (on by default in strict mode, off otherwise) that reports diagnostics for statements that should not appear within a type stub file.

Enhancement: Added diagnostic for a module-level `__getattr__` function defined in a type stub file when in strict mode.

Bug Fix: Fixed bug that caused imports (and other symbols) to be reported as unaccessed if they were accessed from within code that was deemed to be unreachable (e.g. due to the current platform configuration).

Behavior Change: Changed logic for reportUnusedClass and reportUnusedFunction diagnostic rules so they don't report private-named functions and classes within stub files.

Bug Fix: The token "..." should mean an ellipsis object, not the ellipsis class, when used in a normal expression within a non-stub file.

Enhancement (from Pylance): Add python.analysis.autoImportCompletions to control auto-import completions.

1.1.59

Bug Fix: Changed the inferred type of an async function to use `Coroutine` rather than `Awaitable` type. `Coroutine` is a subclass of `Awaitable` and is arguably more correct in this case.

Bug Fix: Fixed a bug in the handling of position-only parameters with default values followed by named parameters or **kwargs.

Bug Fix: Fixed a bug where "yield from" argument was assumed to be an "Iterator", but it should really be an "Iterable".

Bug Fix: Fixed bug where "from .A import A" statement caused symbol "A" to have an inferred type that was a union of a module and other type, even though the other type immediately overwrites the module.

Behavior Change: Changed type stub generator to never generate parameter type annotations based purely on default value types since those can be incorrect or incomplete. Changed type stub generator to automatically add method return types for common magic methods whose return type is always the same.

Behavior Change: Changed type stub generator to avoid emitting functions and methods that begin with an underscore.

Enhancement: Changed type checker to flag unaccessed symbols within type stubs in some cases. It doesn't mark function parameters or variables as unaccessed, and it doesn't mark imports of the form "from x import y as z" or "import a as b" as unaccessed since those are intended to be re-exports.

Enhancement: Changed type checker to treat "..." as an "Unknown" type when used as the RHS of an assignment statement such as "a = ...". This idiom appears sometimes within type stubs, and it should be treated as a missing (unknown) type so stub authors know that they need to fill in a type annotation.

Enhancement: Improved the diagnostic message used to report parameter type mismatches when a parameter name isn't known.

Bug Fix: Fixed a bug whereby a TypeVar in a source type could be conflated with a same-named TypeVar in a dest type when performing TypeVar matching.

Bug Fix: On the Windows platform, avoid calling 'python3' to determine the import paths for the current interpreter. This command can sometimes display a dialog indicating that python isn't installed and can be downloaded from the store.

Page 56 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.