Skip to content

Pylint C0103 (invalid-name) contradiction when module level names matches will class level names #10719

@RomanValov

Description

@RomanValov

Bug description

class Theme:
    INPUT = ">>> "

INPUT = Theme()
Input = Theme()

OUTPUT = Theme()
Output = Theme()

With recent updates of pylint it starts to complain about Input identifier in the code. But changing Input to INPUT produces another complaint. However if I delete INPUT field from class Theme, pylint no longer complains about module-level INPUT.

Configuration

Command used

pylint --disable=all --enable=C0103 ./theme.py

Pylint output

************* Module theme
theme.py:5:0: C0103: Variable name "INPUT" doesn't conform to snake_case naming style (invalid-name)
theme.py:6:0: C0103: Constant name "Input" doesn't conform to UPPER_CASE naming style (invalid-name)
theme.py:9:0: C0103: Constant name "Output" doesn't conform to UPPER_CASE naming style (invalid-name)

------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 3.33/10, +1.67)

Expected behavior

Module-level identifiers INPUT and OUTPUT are treated equally interdependently of class-level identifiers in the same module

Pylint version

pylint 4.0.2
astroid 4.0.1
Python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]

OS / Environment

No response

Additional dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲C: invalid-nameNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions