diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2010-10-28 18:16:52 +0200 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-10-28 18:16:52 +0200 |
commit | d50f32fa5d34e56955d96d3440ade6d6ee134f11 (patch) | |
tree | 5fd3ddaa02d7c698850da7412d2e6ac5a08a4cf9 /checkers/utils.py | |
parent | 880c7ff5bbaafb2507506ed8dfab4b738c81a9c5 (diff) | |
download | pylint-d50f32fa5d34e56955d96d3440ade6d6ee134f11.tar.gz |
py3k: fix __builtin__ vs builtins
Diffstat (limited to 'checkers/utils.py')
-rw-r--r-- | checkers/utils.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/checkers/utils.py b/checkers/utils.py index 6a2b8b2..975ac15 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -19,7 +19,8 @@ """ from logilab import astng -from logilab.common.compat import set +from logilab.common.compat import set, builtins +BUILTINS_NAME = builtins.__name__ try: # python >= 2.4 @@ -48,7 +49,7 @@ def is_super(node): """return True if the node is referencing the "super" builtin function """ if getattr(node, 'name', None) == 'super' and \ - node.root().name == '__builtin__': + node.root().name == BUILTINS_NAME: return True return False @@ -70,13 +71,13 @@ def is_empty(body): """return true if the given node does nothing but 'pass'""" return len(body) == 1 and isinstance(body[0], astng.Pass) -builtins = __builtins__.copy() +builtins = __builtins__.copy() SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__') def is_builtin(name): # was is_native_builtin """return true if <name> could be considered as a builtin defined by python """ - if builtins.has_key(name): + if name in builtins: return True if name in SPECIAL_BUILTINS: return True |