Closed
Description
Bug Report
3rd party library I am using recently added pyright style type: ignore
comments. I have no control on those. Example: https://github.com/Rapptz/discord.py/blob/1c4dca431db375a24820abd23f91796dcf01ad32/discord/app_commands/namespace.py#L124
For some reason mypy complains about these instead of analyzing my code. Shouldnt bad comments in 3rd party code be treated as just type: ignore
?
To Reproduce
python -m venv .venv && source .venv/bin/activate
pip install mypy 'git+https://github.com/Rapptz/discord.py@a909c1ff069b1bdb332b7f3b01ef1c4b8a3a3a15'
- create file
main.py
:
import discord
1 + "2"
mypy main.py
Expected Behavior
mypy should report errors in my code
Actual Behavior
mypy ignores errors in my code and instead complains about bad type: ignore
comments in 3rd party library.
.venv/lib/python3.10/site-packages/discord/client.py:799: error: Invalid "type: ignore" comment
.venv/lib/python3.10/site-packages/discord/client.py:1162: error: Invalid "type: ignore" comment
Found 2 errors in 1 file (errors prevented further checking)
Only if I remove import discord
line, mypy reports error in file.
Your Environment
- Mypy version used:
0.931
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used:
3.10.2
- Operating system and version: Arch Linux