Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Mismatched signature between checker plugin API and implementati…
…on (#17343) This PR changes the `fail` method's signature to be positional-only for the first two parameters, due to a mismatch between the [`CheckerPluginInterface` signature](https://github.com/python/mypy/blob/8dd268ffd84ccf549b3aa9105dd35766a899b2bd/mypy/plugin.py#L242-L244) and the implementation class ([`TypeChecker`](https://github.com/python/mypy/blob/8dd268ffd84ccf549b3aa9105dd35766a899b2bd/mypy/checker.py#L7116-L7118)). ```python class CheckerPluginInterface: ... @AbstractMethod def fail( self, msg: str | ErrorMessage, ctx: Context, *, code: ErrorCode | None = None ) -> None: ... ``` ```python class TypeChecker(NodeVisitor[None], CheckerPluginInterface): ... def fail( self, msg: str | ErrorMessage, context: Context, *, code: ErrorCode | None = None ) -> None: ``` An alternative fix would be to change `TypeChecker.fail`'s parameter name to `ctx`, but that has a greater disruption potential. Co-authored-by: Shantanu <[email protected]>
- Loading branch information