Skip to content
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

False positive inconsistent-return-statements with typing.assert_never #9921

Closed
jamesbraza opened this issue Sep 10, 2024 · 4 comments
Closed
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@jamesbraza
Copy link

Bug description

from enum import StrEnum
from typing import assert_never


class SomeEnum(StrEnum):
    FOO = "foo"

    def do_something(self) -> str:
        if self == SomeEnum.FOO:
            return self.value
        assert_never(self)

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:8:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)

Expected behavior

No pylint error due to typing.assert_never not needing a return.

It looks like #7565 was related, but didn't fully fix.

Pylint version

pylint 3.2.7
astroid 3.2.4
Python 3.12.5 (main, Aug 27 2024, 12:00:37) [Clang 15.0.0 (clang-1500.3.9.4)]

OS / Environment

macOS Sonoma 14.5

Additional dependencies

No response

@jamesbraza jamesbraza added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Sep 10, 2024
@jamesbraza
Copy link
Author

Cc @antoniogamizbadger since you made #9591

@jacobtylerwalls
Copy link
Member

Thanks, can you retest against main?

@jacobtylerwalls
Copy link
Member

#9591 has not been released yet.

@jamesbraza
Copy link
Author

Shoot it passes 😆

Sorry, I saw https://github.com/pylint-dev/pylint/releases/tag/v3.2.7 was out last week, and assumed #9591 was included by now. Sorry for the false positive bug report, closing this out

@jacobtylerwalls jacobtylerwalls added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Sep 12, 2024
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