Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Getting Invalid "type: ignore" comment reports from 3rd party library code #12299

Copy link
Copy link
@Fogapod

Description

@Fogapod
Issue body actions

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

  1. python -m venv .venv && source .venv/bin/activate
  2. pip install mypy 'git+https://github.com/Rapptz/discord.py@a909c1ff069b1bdb332b7f3b01ef1c4b8a3a3a15'
  3. create file main.py:
import discord

1 + "2"
  1. 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
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongmypy got something wrongtopic-type-ignore# type: ignore comments# type: ignore comments

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.