diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2014-08-16 00:25:57 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2014-08-16 00:25:57 +0300 |
commit | c128caf82bb0b64d8bfaa16ff287eb7af5119c45 (patch) | |
tree | cda440d785d649d1ac00a07789d9126581b40843 /checkers/classes.py | |
parent | 71e1f3ba704b45bacd18475dc93e74896c8ec882 (diff) | |
download | pylint-git-c128caf82bb0b64d8bfaa16ff287eb7af5119c45.tar.gz |
Detect calls of the parent's __init__, through a binded super() call.
Diffstat (limited to 'checkers/classes.py')
-rw-r--r-- | checkers/classes.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/checkers/classes.py b/checkers/classes.py index ebca3f2aa..d9ebd8d58 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -818,6 +818,17 @@ a metaclass class method.'} klass = expr.expr.infer().next() if klass is YES: continue + # The infered klass can be super(), which was + # assigned to a variable and the `__init__` was called later. + # + # base = super() + # base.__init__(...) + + if (isinstance(klass, astroid.Instance) and + isinstance(klass._proxied, astroid.Class) and + is_builtin_object(klass._proxied) and + klass._proxied.name == 'super'): + return try: del not_called_yet[klass] except KeyError: |