Fixed a bug that results in a false negative when using bidirectional type inference to evaluate the type of a lambda expression if the expected type is a union of two or more callables.
Fixed bug caused by incorrect synthesis of item and keys attributes for named tuple classes.
Fixed bug that resulted in incorrect bidirectional type inference when calling a constructor for a generic class that defines no __new__ or __init__ method.
Fixed bug that results in a false positive error when a yield statement is used within a lambda following a function.
Fixed a bug that led to poor performance (effectively a hang) if an unannotated function is called through many (greater than 8) call expressions within a loop using different literal-value arguments each time.
Fixed a bug that results in a false positive error when using __extra_items__ (PEP 728) with a TypedDict imported from typing_extensions.
Fixed a bug that leads to an infinite loop when performing protocol matching under certain circumstances that involve recursive protocol definitions.
Fixed a bug that results in a false positive error when Callable() is used as a class pattern and the subject type is Any or Unknown.
Fixed a false negative that occurs when reassigning a Final variable within a class body.
Changed the tokenizer so it is bug-for-bug compatible with the CPython tokenizer in versions 3.10 and newer in the case where a backslash (continuation character) is located by itself on a line.
Fixed a bug that results in incorrect type evaluation when a global (module-scoped) variable is captured within an inner scope and the variable is not modified anywhere below the inner scope. It's possible in this case for the variable to be modified by code outside of the module.
Fixed bug that resulted in incorrect evaluation of an identifier used in a method parameter type annotation if it shadows a forward reference in a class scope when the method is using PEP 695 type parameters.
Fixed a bug that results in a false negative when an Unpack is used in a union. This isn't allowed.
Fixed bug that produces incorrect output when converting to a textual representation the type type[Foo] where Foo is a type alias.
Behavior Changes:
Changed logic that synthesizes the constructor methods for a NamedTuple subclass (using the class syntax) so the __new__ method contains parameters based on field names and the __init__ method contains a general *args: Any, **kwargs: Any parameter signature. Previously, this was swapped, but the new way is more faithful to the runtime.
Changed TypeIs to use the same logic as isinstance type narrowing logic for consistency.
Published 1.1.360
Enhancements:
Added support for @deprecation messages for decorators that wrap a function in a callable object. The deprecated message is now propagated through the ParamSpec and the __call__ method.
Updated typeshed stubs to the latest version.
Behavior Changes:
Moved check for invalid use of class-scoped TypeVar within a self annotation in __init__. It was previously reported under reportGeneralTypeIssues, but it's now moved to reportInvalidTypeVarUse. This was done to help typeshed maintainers migrate away from this pattern.
Changed behavior to no longer exempt unguarded access to not-required TypedDict member within a try or with block. Previously, such errors were exempt, but this is inconsistent with other type checks in pyright which eschew the practice of using exception handling for normal code flow.
Bug Fixes:
Fixed recent regression that affected unannotated __call__ methods in a metaclass. This change aligns pyright's behavior to the typing spec.
Fixed recent regression that incorrectly narrowed the type of kwargs when used in a type guard of the form if "a" in kwargs.
Fixed bug in protocol matching that results in a false positive when the subject object is a dataclass that contains a callable. It should be considered an instance member in this case, so it should not be bound to the class.
Fixed a bug that results in a false positive error when bidirectional type inference is used for a dictionary comprehension when the expected type is a union.
Redesigned the handling of PEP 695-style type parameter scoping to better match the CPython runtime implementation. This fixes multiple bugs with type parameter symbol resolution. For example, if a type parameter is quoted as a forward reference.
Fixed bug that leads to false negative when binding an object to an overloaded method where all of the overloads have incompatible self parameter types.
Fixed bug that leads to incorrect metatype for a class object that is created by calling the metaclass with a two-argument form.
Published 1.1.359
Enhancements:
Expanded support for len(x) == L type guard pattern (where x is a tuple) to support <, <=, > and >= comparisons as well.
Improved some diagnostic messages, moving away from the term "member" to prefer "attribute". Switched from "cannot assign to type" to "incompatible with type" for consistency and clarity.
Extended type narrowing logic for in and not in operators that target TypedDicts to also support constrained TypeVars that use TypedDicts as value constraints.
Added a check for the case where a frozen dataclass overrides a field from its parent class but doesn't provide a default value (where its parent does). This can result in a type violation if the parent's default value is not compatible with the child's (covariant) field type.
Behavior Changes:
Changed behavior when evaluating the upper bound expression, value constraints expression, or default expression for a PEP-695 type parameter. At runtime, these are always evaluated in a deferred manner even if they are not quoted. Pyright now follows the runtime behavior.
Modified handling of annotated self parameter in __init__ method when evaluating constructor call so pyright conforms to the latest typing spec.
Added missing check for the errant use of class-scoped type variables in a type annotation for the "self" parameter within an "init" method. The typing spec now clarifies that this is illegal and should generate an error.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps pyright from 1.1.350 to 1.1.361.
Release notes
Sourced from pyright's releases.
... (truncated)
Commits
ab84d41
Published 1.1.361f4afe40
Published 1.1.360cc3467f
Published 1.1.359989ee29
Published 1.1.3588752be7
Published 1.1.3574106a09
Share heap usage numbers to support cache cleanup in VS code (#7605)9f02004
Published 1.1.356a2831b7
Published 1.1.3550a73f4b
Published 1.1.354114501e
Published 1.1.353Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show