Enhancement: Reimplemented handling of f-strings in accordance with PEP 701, which is included in Python 3.12.0b1. This is a significant change with potential for regressions.
Enhancement: Implemented ReadOnly TypedDict fields to explore proposed PEP 705 variant as discussed in this discussion thread. This prototype will help inform which direction to take with PEP 705.
Bug Fix: Fixed regression that caused an internal assertion (and therefore a crash) when type checking a constructor whose arguments are not type compatible.
Bug Fix: Fixed bug that led to a "leaked" unsolved type variable if a __new__ method used a function-scoped type variable and there was no __init__ method for the class.
Enhancement: A class created with "NewType" should be treated as though it is implicitly @final. The runtime enforces this. Pyright now correctly generates an error if such a class is used as a base class.
Bug Fix: Fixed a false positive error with the reportImplicitOverride check that occurs when the @override decorator is applied to a method that is decorated with a wrapper function that completely replaces the original function with another.
Bug Fix: Fixed places in the pyright code where lists were being expanded on the stack, resulting in a stack overflow (and therefore a crash) if the list is too large.
Enhancement: Added special-case synthesis of the update method for a TypedDict class. For TypedDicts that include at least one read-only field, no updates are allowed. For TypedDicts that are writable, a "partial" type is synthesized that allows for any subset of keys (required or not required) to be passed to the update method.
Behavior Change: Changed protocol matching behavior for protocols that include a variable annotated as ClassVar. A class that defines this same variable as a "regular class variable" (one that is declared at the class level but can be overwritten on a per-instance basis) is now considered compatible with such a protocol.
Behavior Change: Changed type narrowing on assignment for member access expressions that involve an asymmetric __getattr__ and __setattr__ method. As with asymmetric descriptors, it is not safe in this case to assume that the written value will be the same as the read value.
Bug Fix: Fixed a bug that led to a false positive error in certain circumstances with nested call expressions where the expected type of the parameter was a union.
Behavior Change: Changed the behavior when a parameter whose type is a "naked" TypeVar has a default argument value. Mypy doesn't allow this case. Pyright allows it but previously modified the parameter type to be a union of the TypeVar and the type of the default argument. This behavior closed some type validation holes, but it created other problems and was very unintuitive for users. See microsoft/pyright#3130. See microsoft/pyright#2507 for a discussion that led to this original change. This change reverses this behavior. It potentially allows for some unsafe "creative" uses that will go unreported.
Bug Fix: Fixed recent regression that caused useLibraryCodeForTypes setting not to be applied if it was specified in the language server settings (as opposed to the config file).
Enhancement: Updated typeshed stubs to the latest version.
Bug Fix: Fixed bug that resulted in a false positive error when the "expected type" for a lambda is a function that includes a ParamSpec.
Bug Fix (thanks to @LyricLy for the contribution!): Preserve parentheses around unary operators for printing.
Bug Fix: Fixed a couple of bugs in the method override consistency check that resulted in false positives when ParamSpecs were involved.
Bug Fix: Fixed bug that led to the incorrect type evaluation of an async generator when an await operator was used within a nested expression.
Performance: Addressed a performance issue that occurs when analyzing complex functions with deeply nested lambdas. This change adds a more sophisticated type caching mechanism that avoids emptying the cache when analyzing lambdas.
Performance: Added perf optimization to stripLiteralValue method to handle large unions comprised only of literal values.
Performance: Modified constraint solver to limit the number of subtypes in a union for the narrow bound of a type variable. Under certain rare circumstances, this can grow to a very large number and cause perf issues and hangs.
Bug Fix: Fixed a bug that caused an internal cache to be corrupted leading to a false positive error in specific circumstances.
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 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.309 to 1.1.310.
Release notes
Sourced from pyright's releases.
Commits
7e95fe8
Published 1.1.310Dependabot 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 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)