diff options
| author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-04-19 12:51:49 +0300 |
|---|---|---|
| committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-04-19 12:51:49 +0300 |
| commit | df2d1ab9e4d9208ad0d73913f30080310b818cbe (patch) | |
| tree | aa04a6d1705a59f69f41426365893e8615374a56 | |
| parent | 552cb5c718acc10601c17ebab96b8ff30c4dd504 (diff) | |
| download | pylint-df2d1ab9e4d9208ad0d73913f30080310b818cbe.tar.gz | |
Add temporary fix for the builtins check in _determine_callable_obj.
| -rw-r--r-- | pylint/checkers/typecheck.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index e8f45ca..cd5d506 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -114,7 +114,14 @@ def _determine_callable(callable_obj): from_object = new and new.parent.scope().name == 'object' from_builtins = new and new.root().name == BUILTINS - if not new or from_object or from_builtins: + + # TODO(cpopa): In an ideal world, we shouldn't do this. + # In astroid, some builtins are considered to be imports from + # the builtin module. There's issue #96 which should fix this, then + # this check could be removed. This is temporary. + py2_from_builtins = isinstance(new, astroid.From) and new.modname == BUILTINS + + if not new or from_object or from_builtins or py2_from_builtins: try: # Use the last definition of __init__. callable_obj = callable_obj.local_attr('__init__')[-1] |
