Skip to content

protected-access and @classmethod cls #1159

Closed
@alvarocaceres

Description

@alvarocaceres

Steps to reproduce

class C(object):
  _Foo = 12

  @classmethod
  def Enable(cls):
    x = cls()
    print x._Foo  # protected-access warning

Current behavior

W: 7,10: Access to a protected member _Foo of a client class (protected-access)

Expected behavior

Seems like this should be allowed, for consistency with regular methods

pylint --version output

No config file found, using default configuration
pylint 2.0.0, 
astroid 1.5.0
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2]

Metadata

Metadata

Assignees

Labels

Enhancement ✨Improvement to a componentFalse Positive 🦟A message is emitted but nothing is wrong with the code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions