diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-07-08 12:08:07 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2011-07-08 12:08:07 +0200 |
commit | f5b157f004d4f17d1cf81bcf1fa3f9860d9a92eb (patch) | |
tree | 1b796c49dc8ee1ec865627f2753daaab78299512 /node_classes.py | |
parent | 9d8800ca5703f364518240016aaed8e5434b2472 (diff) | |
download | astroid-git-f5b157f004d4f17d1cf81bcf1fa3f9860d9a92eb.tar.gz |
closes #70497: Crash on AttributeError: 'NoneType' object has no attribute '_infer_name' by fixing constant factory
Diffstat (limited to 'node_classes.py')
-rw-r--r-- | node_classes.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/node_classes.py b/node_classes.py index 9bc6c568..2b50e0b9 100644 --- a/node_classes.py +++ b/node_classes.py @@ -885,6 +885,11 @@ _update_const_classes() def const_factory(value): """return an astng node for a python value""" + # since const_factory is called to evaluate content of container (eg list, + # tuple), it may be called with some node as argument that should be left + # untouched + if isinstance(value, NodeNG): + return value try: return CONST_CLS[value.__class__](value) except (KeyError, AttributeError): @@ -894,4 +899,4 @@ def const_factory(value): return Const(value) node = EmptyNode() node.object = value - return None + return node |