Skip to content

Disables immediately after an else clause do not work properly. #872

Open
@dbaum

Description

@dbaum
def my_func(x):
    if x:
        pass
    else:
        # pylint: disable=protected-access
        return x._foo

The disable has no effect here and a warning is generated. If any statement is insert between the else and the disable then it works properly. I suspect the line numbering for the else portion of the ast starts at the first child of the else clause rather than the else keyword itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions