Skip to content

Instruction "pylint: disable=deprecated-typing-alias" does not work in specific case #7928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lorien opened this issue Dec 12, 2022 · 1 comment
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@lorien
Copy link

lorien commented Dec 12, 2022

Bug description

This is the exact code to reproduce the bug. The try/except block is required to see bug. Bug happens when I use "disable:" comment in "else" branch.

import typing
from typing import cast

def test():
    try:
        pass
    except IndexError:
        return lambda: None
    else:
        # pylint: disable=deprecated-typing-alias
        return cast(typing.Callable, lambda: None)

Configuration

No response

Command used

pylint --load-plugins=pylint.extensions.typing test.py

Pylint output

$ pylint --load-plugins=pylint.extensions.typing test.py
************* Module test
test.py:12:20: W6001: 'typing.Callable' is deprecated, use 'collections.abc.Callable' instead (deprecated-typing-alias)

------------------------------------------------------------------
Your code has been rated at 8.75/10 (previous run: 8.75/10, +0.00)

Expected behavior

I expect pylint do not report error "deprecated-typing-alias" because I have explicitly disable it.

Pylint version

pylint 2.15.8
astroid 2.12.13
Python 3.10.8 (main, Nov  4 2022, 09:21:25) [GCC 12.2.0]
@lorien lorien added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 12, 2022
@DanielNoord
Copy link
Collaborator

Duplicate of #872. You can follow that issue to keep updated 😄

@DanielNoord DanielNoord closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2022
@DanielNoord DanielNoord added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants