Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 1 of 81

2019.03.23

Fixed numerous bugs.

1.1.390

Bug Fixes:
* Fixed recent regression that results in incorrect narrowed type when using the `x in y` pattern where `y` is a container type whose element type is `Unknown` or `Any`.
* Fixed bug that causes a false positive overlapping overload error when the overload accepts a `Callable[..., T]` form.
* Fixed a bug that results in a hang under certain circumstances when using a recursive type alias.
* Fixed a bug that leads to a false positive when a function is decorated and has no explicit return type annotation and the body references the decorated function in a loop.
* Fixed a bug that leads to incorrect type evaluation when `__getitem__` is set to a callable object.
* Fixed bug that results in confusing error message when there is a partially-unknown metaclass type detected by the `--verifytypes` command.

Enhancements:
* Updated typeshed stubs to the latest version.
* Added check for `\u` and `\N` escapes within bytes literals, which are illegal.
* Added support for a "bare" `Final` annotation in a dataclass entry that has a default value assigned to it.
* Improved dataclass converters to support generic types.
* Added check for importing a `Final` variable from another module and then attempting to overwrite it.
* Added check for an attempt to assign to a module-local variable if it is shadowing a `Final` variable declared by the builtins module or some other chained file.
* Added support for evaluating the `slice` class type arguments for slice expressions.
* Added check for invalid use of `ClassVar` qualifier within a `NamedTuple` or `TypedDict` attribute annotation.

Behavior Changes:
* Changed inference logic for exception groups to more closely match the runtime. If a non-base exception is targeted, the inferred type is now `ExceptionGroup` rather than `BaseExceptionGroup`.

1.1.389

Bug Fixes:
* Fixed bug that results in a false negative if a `|` union operator creates a union of generic types. These types should be specialized with default type arguments.
* Fixed bug that results in false negative when raising a value of type `None`.
* Fixed bug that results in an incorrect type evaluation when a `match` statement uses a pattern with a target expression that overwrites the subject expression.
* Fixed bug that results in a missing `reportUnknownArgumentType` error if the argument is an expression involving an `__init__` parameter in an unannotated (pseudo-generic) class.
* Fixed bugs that resulted in false positive errors when using an expression of the form `type(A)` as a base class or a metaclass in a class definition.
* Fixed bug that leads to false positive when a method is overridden by a polymorphic method.
* Fixed bug that affects pyproject.toml files with an emoji character by switching to a different toml parser.
* Fixed a bug that results in a false negative when a class is used in a type annotation for a method parameter and both the class and the method are generic and use PEP 695 syntax.
* Fixed a bug that results in a false positive "--verifytypes" error when using an explicit `TypeAliasType` call to create a public symbol in a "py.typed" library.
* Fixed bug that results in the incorrect detection of an asymmetric descriptor if the descriptor class is generic.

Enhancements:
* [From Pylance]: Improved signature help to skip keyword-only params with invalid names.
* Added checks for `except*` clause to report invalid usage that is flagged as a syntax error at runtime.
* Added check for the illegal use of an `await` keyword in a lambda.
* Added missing checks for illegal use of `await` and `async` within list, set and dictionary comprehensions within a non-async function.
* Improved a confusing error message that results when a class is assigned to an incompatible class.
* Added narrowing support for a TypedDict value, which can be assumed never to be falsy if it has at least one required entry.
* Improved the "x is y" and "type(x) is y" type guards to better handle the case where `x` is a TypeVar.
* Updated typeshed stubs to the latest version.

1.1.388

Bug Fixes:
* Fixed a bug that results in a false positive when a class is defined within a generic function and uses type parameters from that function.
* Fixed a bug that results in unexpected constraint solver results in certain cases involving arguments with lambda expressions.
* Fixed bug that results in false positive under certain circumstances involving classes parameterized with a contravariant type variable.
* Fixed bug that results in incorrect evaluation of class variables assigned in an `__init_subclass__` or `__class_getitem__` method. These methods are implicitly class methods even though they are not decorated with `classmethod`.
* Removed recent check for illegal identifiers used in `alias` for `dataclass_transform` field. This isn't an illegal condition, so the resulting error was a false positive. Instead, changed completion provider to not suggest the illegal identifier as a valid keyword argument.

Enhancements:
* Enhanced the special-case logic for functools.partial so it handles the case where the function has a `**kwargs` parameter typed with an unpacked TypedDict.
* Improved the synthesized type of the `keys`, `values` and `items` methods on a closed TypedDict to provide a more precise (narrower) type for the key values.
* Improved the handling of a TypeVar whose definition involves a circular definition.
* Added check for `__slots__` initialization when the `__slots__` list is empty and the class is marked `final`.

1.1.387

Bug Fixes:
* Fixed bug that leads to a false negative when passing multiple `*args` or `**kwargs` arguments to a callable parameterized by a ParamSpec.
* Fixed issue that results in a false positive "type could not be determined because it refers to itself" error caused by a false dependency due to narrowing logic. This may also improve type analysis performance in some code.
* Switched to a different toml parser to avoid incompatibility with the latest toml standard.
* Changed the evaluated type of an `in` or `not in` operator to be `bool` if the LHS doesn't support containment. Previously, the expression evaluated to `Never`.
* Fixed a bug that results in a false positive when a class parameterized by a TypeVarTuple is used in conjunction with a Self type.
* Fixed bug that results in incorrect type evaluation when performing protocol matching that involves an attribute with a callable type parameterized by a ParamSpec.
* Added protection for an internal call stack overflow when inferring return types in deep call hierarchies within untyped code.
* Fixed a false positive "incompatible method override" error in a case that involves both class-scoped and method-scoped type variables.
* Fix recent regression that broke hover text on `.get()` of `TypedDict` instance.
* Fixed a bug that causes a false positive error when a class uses `type(Protocol)` as a base class.

Enhancements:
* Enhanced type narrowing logic for "x == <literal>" type guard pattern to handle the case where `x` is a type variable with a literal upper bound or value constraints that are literals.
* Improved detection of asymmetric descriptors to handle the case where the `__set__` and `__get__` methods are overloaded.
* Added experimental support for draft PEP 764: Inlined typed dictionaries.
* Changed check in the pyright VS Code extension for the presence of Pylance. If Pylance is installed in the workspace but is not configured to be loaded (i.e. the "python.languageServer" is set to "None"), then pyright will allow itself to be loaded.

1.1.386

Bug Fixes:
* Fixed issue that results in non-deterministic false positive error, often relating to the "awaitable" check.
* Fixed bug that results in a false positive error when using a traditional generic type alias defined with a "naked" type variable surrounded by `Annotated` within a Python 3.12 `type` statement.
* Fixed a bug that leads to a false positive when using asssert_type with a **kwargs parameter that is annotated with an unpacked TypedDict.
* Fixed recent regression that results in a spurious type error when accessing an instance variable `self.x` if `x` has the type of a class-scoped type variable with a default value.
* Fixed a recent regression that results in false positive errors under certain circumstances that involve assignability checks for two callables that involve a `*args: *tuple[]` parameter.
* Fixed bug that results in a false positive when resolving a multi-part import target that involves a circular dependency.
* Fixed regression that results in a false positive error (and an error that is reported at a bogus location) when overriding a dataclass field with a converter.
* Fixed bug in constraint solver that resulted in behavior that differed depending on the order of methods in a protocol.
* Fixed a bug that results in a spurious error when specializing an old-style generic type alias whose type is defined as a new-style type alias that has multiple type parameters, only some of which are used in its type definition.
* Fixed bug that leads to incorrect type narrowing in the negative ("else") case when using `isinstance` with a filter type that is typed as `type[X]`.
* Fixed bug that results in a false negative when the specialization of a ParamSpec results in a signature that has a duplicate parameter name where one parameter has a default value and the other does not.

Enhancements:
* Added a limit to the number of typed declarations that will be evaluated for a single symbol. This mitigates performance issues with code that redeclares a symbol hundreds or thousands of times.
* Updated support for "closed" TypedDict to match latest updates to PEP 728.
* Enhanced the `type(y) == x` type guard logic to support the case where `y` is declared as a type variable with an upper bound that overlaps with the type of `x`.
* Updated typeshed stubs to the latest version.
* Updated toml parser library to support toml 1.0.0 syntax.
* Removed the limitation that the "ignore" setting in a config file must be relative to the project root.

Page 1 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.