Open
Description
Bug Report
mypy isn't recognizing type: ignore
if it is after some other comment, e.g.:
tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type]
To Reproduce
method strcuture (copied):
(method) def compare_structural_equality(
obj: Tree,
message_object: MessageObject = MessageObject("")
) -> bool
Compare the structure of this tree with another tree.
Args
obj : Tree
The tree to compare with.
message_object : MessageObject
Object to store messages about differences.
Returns
bool
True if structures are equal, False otherwise.
tree1.compare_structural_equality(None) # type: ignore[arg-type] # pyright: ignore[reportArgumentType]
=> works 👍
tree1.compare_structural_equality(None) # pyright: ignore[reportArgumentType] # type: ignore[arg-type]
=> doesn't works 🤷
Expected Behavior
Bove examples work
Actual Behavior
Only the first example works
Your Environment
- Mypy version used:
mypy 1.16.1 (compiled: yes)
- Mypy command-line flags:
none
- Mypy configuration options from
mypy.ini
(and other config files): frompyproject.toml
[tool.mypy]
python_version = "3.12"
ignore_missing_imports = true
strict = true
show_error_codes = true
- Python version used:
Python 3.12.0
I am sorry If I missed an explanation for this. I also don't know if it is appropriate to use mypy and pyright.
In my opinion both examples should work.