Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 25 of 81

1.1.250

Behavior Change: Removed the assumption that deferred evaluation of annotations is enabled by default in Python 3.11. It looks like this won't be the case.

Bug Fix: Fixed bug that resulted in false negative when using a variable in a type annotation if the type of that variable evaluated to `Unknown`.

Bug Fix: Fixed bug in code flow engine that caused type narrowing to fail in some cases where a conditional check was nested at least two loops deep.

Enhancement: Enhanced TypedDict support in completion provider to support unions that contain TypedDicts.

Bug Fix: Fixed bug that resulted in false negative when dunder methods are assigned as instance variables rather than class variables.

Bug Fix: Fixed bug that caused `__slots__` entries to be treated as instance variables rather than class variables when looking up dundered methods.

Bug Fix: Fixed a bug that led to a false positive error when using a variable or parameter of type `type[T]` in a class pattern for a case statement.

Bug Fix: Fixed bug that resulted in a false negative when assigning a union that included an Unknown or Any to another type when invariance was enforced (e.g. `list[Any | str]` was considered assignable to `list[int]`).

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed bug that resulted in incorrect type evaluation for a recursive call to a generic function.

1.1.249

Bug Fix: Fixed bug that resulted in incorrect type evaluation of a specialized type alias when the type argument contained a literal type. The literal was incorrectly widened to its non-literal form.

Bug Fix: Fixed bug that resulted in the incorrect type evaluation of member access expressions where the base type is `type(None)` (i.e. the `NoneType` class).

Enhancement: Enhanced the `reportInvalidTypeVarUse` check to report cases where a TypeVar found within a return type may go unsolved because it appears only within input parameters that have default argument values specified as `...`. In this situation, it is recommended that an overload is provided that specifies the return type when the default argument value is used by a caller.

Bug Fix: Fixed bug that resulted in a false positive when assigning a function or callable containing position-only parameters to a callable with a TypeVarTuple.

Bug Fix: Fixed bug that caused docstrings to be truncated to 32 characters when generating stubs.

Enhancement: Enhanced `reportInvalidTypeVarUse` to detect cases where a constructor (`__init__` method) includes class-scoped TypeVars that may go unsolved because they are associated only with parameters that have default argument values.

1.1.248

Enhancement: Added more complete validation of types used within a PEP 604-style union. Previously, the use of a P.args or P.kwargs type was not flagged as an error as it should be.

Bug Fix: Fixed bug that resulted in a false positive error when an `await` keyword was used with an operand that evaluated to a bound type variable.

Bug Fix: Fixed a bug that resulted in a false positive when using `*args` or `**kwargs` within a class argument list.

Enhancement: Improved special-case code for functools.totalordering so it enforces the operand type in the provided `__lt__` method.

Bug Fix (from pylance): Honor the "hasWatchFileRelativePathCapabilities" of the client and don't use this facility if it's unsupported.

Bug Fix: Fixed a bug that caused dataclass_transform to fail when used on an overloaded function if it was not applied to the first overload.

Enhancement: Improved parse recovery for member access expressions that are missing the member name. This allows completion suggestions to work when a member access expression is used within a list comprehension.

Behavior Change: Changed `reportInvalidStubStatement` rule so it doesn't complain about call and augmented assignment expressions that perform allowed manipulations of the `__all__` symbol.

Bug Fix: Fixed false positive type error that occurred when evaluating a call to a generic function parameterized with a ParamSpec and called within a loop construct.

Bug Fix: Fixed a bug that resulted in inconsistent type evaluation for a captured variable within a lambda or inner function when found within a loop.

Behavior Change: Updated dataclass_transform to support parameter name `field_specifiers`, which replaces the older parameter named `field_descriptors`. For now, we'll support both to retain backward compatibility with libraries that shipped with the older form.

Bug Fix: Fixed a bug that affected type evaluation of member access expressions when the LHS was a dataclass (or dataclass-like) class and the member was a field declared as a descriptor type.

Bug Fix: Fixed regression that resulted in a false positive error when checking for incompatible method overrides when the method contained local TypeVars.

Bug Fix: Fixed false positive "code too complex" error caused by a recent regression.

Bug Fix: Fixed bug in completion provider where it was emitting four spaces rather than using the predominant tab sequence when generating a multi-line completion suggestion for a method override.

Bug Fix: Fixed bug that resulted in a false positive error when using a super() call to invoke a constructor with a default argument value and a parameter that is annotated with a TypeVar.

Bug Fix: Fixed bug that resulted in incorrect type evaluation for a property access within a class when that property's getter has a generic return type.

Enhancement: Updated typeshed stubs to the latest version.

1.1.247

Bug Fix: Fixed bug in symbol resolution when a symbol is associated with a class scope but not yet assigned a value. In this case, the runtime looks in the global (module) scope for the symbol rather than following the normal scope hierarchy.

Bug Fix: Fixed a bug that led to a false negative when calling a Callable callback with a generic parameter and passing a non-generic argument.

Bug Fix: Changed the behavior of the type evaluator for generic functions and constructors where a TypeVar is unsolved. Previously, the TypeVar was "leaked". Now it is transformed into an "Unknown" type.

Performance: Added small performance and memory optimization in binder that avoids some extra work related to member access expressions.

Performance: Added code to detect execution flows with long straight-line code flow graph segments. This is not captured in the cyclical code complexity calculations that we normally use to determine if code is too complex to analyze.

Enhancement: Improved handling of context managers that swallow exceptions. The type of the context manager is now evaluated using the full type analyzer. The previous technique used some special-case handling which covered about 95% of the cases but left some cases unhandled.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Adjusted heuristics for TypeVar constraint solver to better handle the case where a union is assigned to a union of TypeVars and the number of subtypes in these two unions is the same.

Bug Fix: Fixed a bug that resulted in a false negative when doing protocol matching with a generic class that calls its own constructor.

1.1.246

Bug Fix: Fixed a bug in the `reportUninitializedInstanceVariable` check that results in a false positive error with TypedDict classes.

Bug Fix: Fixed a bug in the logic for synthesizing `__init__` methods within a dataclass when a `__slots__` definition is present. It was using the order of the slots entries rather than the order of the field declarations.

Enhancement: Added new verbose output for CLI when combined with '--stats' that outputs the total analysis time of each source file. This will help us narrow down performance problems.

Enhancement: Added check for an attempt to overwrite a method that is marked `final`.

Bug Fix: Fixed a bug that resulted in a false positive `reportUnknownVariableType` diagnostic when using `from .A import B` statement. The symbol `A` was flagged as an "unknown" type even though it is not a symbol within the module's symbol table (unless the file is an `__init__.py[i]`).

Enhancement: Updated typeshed stubs to the latest.

1.1.245

Enhancement (from pylance): Added completion support for class variables inherited from a parent class.

Bug Fix: Fixed a bug that resulted in a stack overflow in rare cases where an unannotated decorator was used on hundreds of functions or methods within the same file.

Enhancement (from pylance): Improved completion suggestions for dict key names within an fstring expression. Double or single quotes are now chosen to avoid conflicting with the outer fstring quote type.

Bug Fix: Fixed bug that resulted in false positive error when using a member access expression within a list of base classes in a class declaration statement.

Behavior Change: Changed the heuristics in the TypeVar constraint solver to preserve literals when solving for a TypeVar in a Callable return type in cases where the source function has a declared return type with a literal annotation in it. It doesn't apply in cases involving an inferred return type or generic types that are specialized with literals.

Bug Fix: Fixed a bug in the `reportUninitializedInstanceVariable` check that results in a false positive when used with a dataclass or dataclass-like class. Seemingly-uninitialized class variables are implicitly overwritten by the synthesized `__init__` method in a dataclass.

Performance: Fixed performance issue that occurred in certain situations involving deeply nested loops and many unannotated variables that are dependent on each other.

Enhancement: Added support for generic TypedDict classes.

Page 25 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.