Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 32 of 81

1.1.210

Behavior Change: Removed support for two-argument form of `TypeGuard` including support for "type asserts". The feedback on this idea was relatively negative.

Enhancement: Added provisional support for a proposed `StrictTypeGuard` feature. For details, refer to [this discussion](https://github.com/python/typing/discussions/1013).

Enhancement: Added support for old-style (pre-await) coroutines.

Bug Fix: Fixed a bug that resulted in a false positive in cases involving bidirectional type inference with an expected callable type where one or more of the parameter types was a tuple with non-literal element types and the provided argument was a tuple with a literal value.

Bug Fix: Improved limit check for literal math.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug that results in false positive when using a `super().__init__` call within a metaclass `__init__` method.

Bug Fix: Fixed bug that results in a false positive error when using `yield` within the outermost iterator of a list comprehension.

Bug Fix: Fixed a bug that resulted in a false positive when importing `OrderedDict` from `typing_extensions`. Added a mechanism for loading typeshed modules on demand within the type evaluator, including `collections/__init__.pyi` which declares the real `OrderedDict` class.

Enhancement: Added improved checks for size mismatches when unpacking known-length iterables into a list target (like `[a, b] = (1, 2, 3)`).

Behavior Change: Changed the `setdefault` method generated for TypedDict classes so it accepts only literal key values. Fixed a bug in the `get` method generated for TypedDict classes so it accepts arbitrary values for the default value parameter.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when using a generic type alias that consists of a union of multiple type variables that are filled with the same type when the type alias is specialized.

Behavior Change: Modified the `reportMissingSuperCall` diagnostic based on feedback. It now emits an error for classes that include an `__init__` and don't call through to `super().__init__` even if that class derives from `object`, unless it's marked `final`.

1.1.209

Enhancement: Added support for "literal math" for certain unary and binary operations where the operands are all the same literal class types (str, bytes, int, or bool). For example, `Literal[0, 1]` + `Literal[1, 2]` results in type `Literal1, 2, 3]`.

Enhancement: Implemented a new diagnostic check "reportMissingSuperCall" that checks for `__init__`, `__init_subclass__`, `__enter__` and `__exit__` methods that fail to call through to their parent class(es) methods of the same name. This is a common source of bugs. The check is disabled by default. We may eventually enable it by default in strict mode, but we want to get feedback before doing so.

Behavior Change: Changed text output of CLI version to use the word "information" rather than "info" for consistency with JSON output.

Bug Fix: Fixed bug that resulted in a crash if `Self` was used in a type argument within a method decorator.

Behavior Change: Changed behavior to allow `Self` to appear within a `ClassVar` type.

Bug Fix: Fixed bug that resulted in an incorrect type evaluation when `Self` was used as a return type annotation for a property or class property.

1.1.208

Enhancement (from pylance): Added support for USERNAME and VIRTUAL_ENV shell variables in ".env" file.

Enhancement (from pylance): Improved completion provider suggestions for static members.

Bug Fix: Reverted check for base classes that use variables. It was too disruptive, so another approach is needed.

1.1.207

Bug Fix: Fixed bug that results in false positive error when a function signature captured by a ParamSpec includes an *args or **kwargs parameter.

Bug Fix: Fixed bug that resulted in false positive error and unclear error message with the reportIncompatibleMethodOverride check.

Behavior Change: Changed type analysis of `def` statements to insert implicit `/` parameter (a position-only parameter separator) when one or more parameter names start with double underscores.

Bug Fix: Fixed a bug that resulted in no error being emitted when an `await` keyword was used with a `Generator` object.

Bug Fix: Fixed bug that resulted in false positive error when accessing a staticmethod or classmethod from a protocol class.

Bug Fix: Fixed bug that prevented a file-level override of `reportUnnecessaryTypeIgnoreComment` from working correctly.

Bug Fix: Fixed bug that resulted in a false positive error when adding a 'staticmethod' or 'classmethod' decorator to an already-decorated method.

Enhancement: Updated typeshed stubs to latest.

Enhancement: Improved check for index values for tuples to handle unions of tuples.

Enhancement: Added new diagnostic check `reportInconsistentConstructor` that checks for inconsistent input signatures between `__new__` and `__init__` methods.

Bug Fix: Added a check for base classes specified in a class declaration that is not a concrete class but instead a variable (dynamic) type.

1.1.206

Bug Fix: Fixed a bug in the logic that determines whether a call expression is a "NoReturn". In particular, the logic wasn't handling the case where the call was to the constructor of a class that had a custom metaclass that defined a `__call__` method.

Bug Fix: Fixed regression that caused a false positive error when attempting to invoke constructor for a class derived from `ctypes.Structure`. This class uses a custom metaclass with a custom `__getattr__` method.

Bug Fix: Updated heuristics in type variable constraint solver to better handle literals in the case where bidirectional type inference is being used.

Enhancement: Updated `dataclass_transform` support so it applies to both metaclasses and base classes to conform to the latest version of the specification.

Bug Fix: Fixed bug that resulted in false positive errors when dealing with protocol classes that referred to themselves internally.

Bug Fix: Fixed bug in `reportIncompatibleMethodOverride` diagnostic check where it omitted an error if an overridden method had a decorator applied.

Bug Fix: Fixed a bug in the type evaluation of the two-argument for of `super()` when the second argument is a class instance and the call is made from within a class or static method.

Behavior Change: Added implied position-only parameter separator for `Concatenate` operator.

Enhancement: Added new diagnostic check `reportUnnecessaryTypeIgnoreComment` that emits a diagnostic when a ` type: ignore` comment has no effect.

Bug Fix: Fixed several bugs in type var constraint solver related to functions that have parameters that are callable that have parameters that are callable.

1.1.205

Enhancement: Improved type narrowing for `x.y == L` pattern to also support `x.y is L` if `L` is a `bool` or enum literal.

Bug Fix: Fixed regression that resulted in a false positive error when assigning an empty tuple to a declared type that involved an unbounded tuple.

Bug Fix: Fixed bug that causes a crash due to infinite recursion.

Bug Fix: Fixed recent regression that resulted in a crash when using a zero-length tuple as a function argument.

Bug Fix: Fixed bug that resulted in the first parameter of a local function declared within a method to be interpreted as a "self" parameter.

Bug Fix: Fixed bug that resulted in a false positive when using a decorator that applies to a method and provides a type for the parameter corresponding to "self".

Bug Fix: Fixed bug in tokenizer that resulted in a missing error when the first statement in a source file is preceded by whitespace.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed bug that resulted in false positive error when a ParamSpec was bound to a generic function with some unresolved TypeVars.

Behavior Change: Changed behavior of type alias declarations that use a generic class or alias in the RHS without any subscripts or unions. These are treated as unspecialized aliases, whereas they were previously specialized with `Any` type arguments.

Page 32 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.