Pyright

Latest version: v1.1.390

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

Scan your dependencies

Page 38 of 81

1.1.174

Behavior Change: Modified import resolution logic to handle namespace stub packages. This case isn't explicitly covered by PEP 561, but there is a proposal to amend the PEP to clarify how to handle this case.

Bug Fix: Fixed bug that resulted in a false negative when dealing with types that are conditioned on constrained or bound TypeVars.

Bug Fix: Fixed bug that affected a missing type argument for a ParamSpec type parameter. It should be an Unknown type.

Bug Fix: Fixed bug that resulted in an `Unknown` type appearing in a type evaluation for an unannotated variable that is modified in a loop.

Enhancement: Added error reporting for an attempt to subclass an Enum class and a duplicate definition of enum members.

Enhancement: Improved error reporting for index expressions used for non-generic classes.

Enhancement: Fixed performance issue in stub generation code that caused stub generation to take longer than needed.

Enhancement: Added performance improvement that skips return type inference for functions whose parameters are not annotated and have a "code flow complexity" beyond a certain threshold.

Bug Fix: Fixed bug the resulted in a false positive when an overloaded function is passed as an argument to a function that accepts a callable parameter using generics.

Bug Fix: Fixed a false positive error when a class with an overloaded constructor is passed as an argument to a callable parameter.

Bug Fix: Fixed bug in type var matching logic that resulted in a false positive when using a generic class that conforms to a generic protocol and uses that protocol within its own method signatures.

1.1.173

Bug Fix: Fixed a false positive error with the new union syntax when the LHS expression is an Any or Unknown type.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug in ParamSpec specialization code that can occur when using a generic type alias with a ParamSpec.

Bug Fix: Fixed false positive error when assigning a callable to a callback protocol that includes a ParamSpec.

Bug Fix: Fixed bug that resulted in unbound variable condition not being reported if it was in a loop and was assigned conditionally.

Bug Fix: Fixed bug relating to the use of an `Any` type argument corresponding to a ParamSpec type parameter.

Bug Fix: Fixed a false positive error when using a generic descriptor class that is parameterized by the `self` or `cls` parameter of the class that allocates the descriptor.

Enhancement: Added check for inappropriate use of a field annotated with `InitVar`.

Bug Fix: Fixed bug that resulted in a false positive error when a protocol class used generic type parameters scoped to a method.

1.1.172

Enhancement: Added completion suggestion support for TypedDict keys and values. Thanks to Robert Cragie for this contribution!

Behavior Change: Changed behavior of reportInvalidTypeVarUse diagnostic check to flag bound type variables used as type arguments within return type annotations.

Enhancement: Implemented code that applies type narrowing to local variables and parameters when they are captured by an inner-scoped lambda or function and the variable or parameter is not reassigned after the lambda or function along any code flow paths.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed a bug in ParamSpec handling that resulted in false positives when a callable type containing a ParamSpec was assigned to another callable type containing a ParamSpec.

Enhancement (from pylance): Improved handling of type checking when files are opened in "single file" mode, rather than opening a project root directory.

Enhancement (from pylance): Implemented heuristic for detecting import roots within a project. Previously, these all needed to be specified through "extraPaths" settings, but now pyright is smarter about locating these directories automatically.

Bug Fix: Fixed false positive error when a generic class with a ParamSpec type parameter implements a descriptor protocol.

1.1.171

Bug Fix: Fixed bug in TypeVarTuple support that prevented the use of an unpacked TypeVarTuple within a type argument list for types other than Tuple or Union.

Bug Fix: Fixed bug in synthesized `__new__` method for NamedTuple class that caused the constructor of subclasses of the NamedTuple to construct the base class.

Bug Fix: Fixed bug where a class whose constructor is unannotated was allowed to have explicit generic type arguments.

Behavior Change: Changed type evaluation behavior for protected instance variables (those that begin with a single underscore) and are assigned a literal value. Previously, the literal type was retained if the `reportPrivateUsage` was enabled. This caused various problems. It was a bad idea because type evaluations should not differ based on diagnostic reporting switches.

Enhancement: Added logic to report a diagnostic if an instance variable is assigned only via an augmented assignment expression.

Bug Fix (from pylance): Fixed bug in parser that resulted in incorrect text range for relative module names in import statements.

Bug Fix: Improved inference of generator statements that involve `await` statements to conform to the runtime behavior of the CPython intepreter.

Bug Fix: Fixed bug that caused inconsistent handling of dataclasses that use the `dataclass` decorator and derive from abstract base classes.

Bug Fix: Fixed bug that caused yield expression to be evaluated as "unknown" in some cases when it was contained within a loop.

Bug Fix: Fixed bug that resulted in incorrect type evaluation for expressions within an `await` statement under some circumstances.

Behavior Change: Changed code that converts types to textual representation to prepend a tilde ("~") character for the inferred type of a "self" or "cls" parameter.

Enhancement: Updated typeshed stubs to the latest.

1.1.170

Bug Fix (from Pylance): Handle unrooted execution environments (e.g., open file mode), preventing various crashes and oddities.

Bug Fix (from Pylance): Generate default values in method overload signatures. Previously, we didn't include them, which generated the wrong signature.

Bug Fix (from Pylance): Use attribute docstrings for type aliases in completion and hover.

Bug Fix (from Pylance): Modify parser to change the range of parenthesized expressions to their contents. This improves the ranges returned in hovers, document highlight, etc.

Bug Fix: Improved member access logic to more faithfully match the Python interpreter's behavior when the member is assigned through a class, that member is a class itself, and that class has a metaclass that implements a descriptor protocol. It appears that the interpreter does not call through to the metaclass's `__set__` method in this case, even though it does call its `__get__` method when the member is accessed in the same circumstance.

Enhancement: Extended reportCallInDefaultInitializer diagnostic check to disallow list, set or dict expressions in default argument expression.

Bug Fix: Improved `isinstance` and `issubclass` narrowing to handle open-ended tuples passed as the second argument.

Bug Fix: Fixed false positive error when `namedtuple` constructor is called with a list of field names that includes dynamic (non-literal) expressions.

Bug Fix: Fixed false positive error where an exception class (as opposed to an exception object) is used in a "from" clause in a "raise" statement.

Enhancement: Added support for ParamSpec matching when used within a callback protocol. PEP 612 is unclear on whether this should be supported, by pyre (the reference implementation for the PEP) does support it.

Bug Fix: Fixed false negative error in parser where it did not correctly detect a syntax error when a walrus operator was used in a ternary operator condition expression.

Bug Fix: Fixed bug that resulted in false negative when bidirectional type inference involved an "expected type" of Any and the type being evaluated was a call expression that returned a generic object as a return value.

Bug Fix: Fixed infinite recursion bug in hover provider when a symbol referred to both a locally-defined class and an imported symbol.

Bug Fix: Fixed bug that resulted in false positive when using unpack operator with `self` when `self` refers to a named tuple or a tuple with known length.

Behavior Change: Allow symbols that are not explicitly re-exported from a stub to be imported into another stub. This change is required to support recent updates to typeshed.

Enhancement: Updated typeshed stubs to the latest.

1.1.169

Bug Fix: Improved type narrowing logic for `a is b` pattern where `a` is `self` (or a bound TypeVar) and `b` is an enum literal.

Bug Fix: Updated reportIncompatibleMethodOverride diagnostic check to special-case dict key names that overlap with method names in the `_TypedDict` class.

Bug Fix: Improved handling of attribute accesses for classes that inherit from `Any` or an unknown class.

Enhancement: Added optimization that reduces the time it takes to perform code flow analysis in the presence of if/elf/else statements, try statements, with statements, and ternary expressions.

Bug Fix: Fixed bug that caused false positive when a bound TypeVar is bound to an instantiable class (e.g. Type[X]).

Page 38 of 81

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.