fix a magic method problem

This commit is contained in:
David Halter
2013-08-02 15:10:15 +02:00
parent 68d02df017
commit 997e506038
2 changed files with 4 additions and 2 deletions

View File

@@ -787,8 +787,8 @@ def follow_path(path, scope, call_scope, position=None):
def filter_private_variable(scope, call_scope, var_name): def filter_private_variable(scope, call_scope, var_name):
"""private variables begin with a double underline `__`""" """private variables begin with a double underline `__`"""
if isinstance(var_name, (str, unicode)) \ if isinstance(var_name, (str, unicode)) and isinstance(scope, er.Instance)\
and var_name.startswith('__') and isinstance(scope, er.Instance): and var_name.startswith('__') and not var_name.endswith('__'):
s = call_scope.get_parent_until((pr.Class, er.Instance)) s = call_scope.get_parent_until((pr.Class, er.Instance))
if s != scope and s != scope.base.base: if s != scope and s != scope.base.base:
return True return True

View File

@@ -224,6 +224,8 @@ A.__init__
#? ['__init__'] #? ['__init__']
B.__init__ B.__init__
#? ['__init__']
int().__init__
# ----------------- # -----------------
# comments # comments