From 997e5060381c1b597adbfe98584f80e8282cdbef Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 2 Aug 2013 15:10:15 +0200 Subject: [PATCH] fix a magic method problem --- jedi/evaluate.py | 4 ++-- test/completion/basic.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate.py b/jedi/evaluate.py index cc597cc8..38d3ebc5 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -787,8 +787,8 @@ def follow_path(path, scope, call_scope, position=None): def filter_private_variable(scope, call_scope, var_name): """private variables begin with a double underline `__`""" - if isinstance(var_name, (str, unicode)) \ - and var_name.startswith('__') and isinstance(scope, er.Instance): + if isinstance(var_name, (str, unicode)) and isinstance(scope, er.Instance)\ + and var_name.startswith('__') and not var_name.endswith('__'): s = call_scope.get_parent_until((pr.Class, er.Instance)) if s != scope and s != scope.base.base: return True diff --git a/test/completion/basic.py b/test/completion/basic.py index 9ce4dad4..41e489e6 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -224,6 +224,8 @@ A.__init__ #? ['__init__'] B.__init__ +#? ['__init__'] +int().__init__ # ----------------- # comments