Skip to content

False Negative function-redefined when function named with leading underscore #9894

@daviderie

Description

@daviderie

Bug description

When defining a function that is named with a leading underscore, Pylint does not raise the function-redefined error as expected.

E.g.:

def _my_func(self):
    ...

def _my_func(self):
    ...

Configuration

defaults

Command used

pylint my_package

Pylint output

-------------------------------------------------------------------
Your code has been rated at 10.00/10

Expected behavior

E0102: method already defined line 86 (function-redefined)

Pylint version

pylint 3.2.6
astroid 3.2.4
Python 3.11.3 (main, May  4 2023, 15:16:43) [Clang 14.0.3 (clang-1403.0.22.14.1)]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

Labels

False Negative 🦋No message is emitted but something is wrong with the codeGood first issueFriendly and approachable by new contributorsHelp wanted 🙏Outside help would be appreciated, good for new contributors

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions