diff options
author | Mads Kiilerich <mads@kiilerich.com> | 2009-01-18 16:04:44 +0100 |
---|---|---|
committer | Mads Kiilerich <mads@kiilerich.com> | 2009-01-18 16:04:44 +0100 |
commit | 466af879a36bad38c830c0c09ee10d7a93ae9624 (patch) | |
tree | 42a3a5cb74578f823229428bc2d709669e429987 /checkers/variables.py | |
parent | 45694b2338d18291cb3d1931cd0434cab8aa65e6 (diff) | |
download | pylint-466af879a36bad38c830c0c09ee10d7a93ae9624.tar.gz |
Decorators of methods should see the class namespace
- just like default values does but the body doesn't.
Fixes
https://www.logilab.net/elo/ticket/3711 - bug finding decorator arguments
https://www.logilab.net/elo/ticket/5626 - name resolution bug inside classes
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index a3b1501..d57df66 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -24,7 +24,7 @@ from logilab.astng.lookup import builtin_lookup from pylint.interfaces import IASTNGChecker from pylint.checkers import BaseChecker -from pylint.checkers.utils import is_error, is_builtin, is_func_default, \ +from pylint.checkers.utils import is_error, is_builtin, is_func_default, is_func_decorator, \ is_ancestor_name, assign_parent, are_exclusive, \ is_defined_before #, is_parent, FOR_NODE_TYPES @@ -326,10 +326,10 @@ builtins. Remember that you should avoid to define new builtins when possible.' name = node.name stmt = node.statement() frame = stmt.scope() - # if the name node is used as a function default argument's value, then + # if the name node is used as a function default argument's value or as a decorator, then # start from the parent frame of the function instead of the function - # frame - if is_func_default(node) or is_ancestor_name(frame, node): + # frame - and thus open an inner class scope + if is_func_default(node) or is_func_decorator(node) or is_ancestor_name(frame, node): start_index = len(self._to_consume) - 2 else: start_index = len(self._to_consume) - 1 |