summaryrefslogtreecommitdiff
path: root/node_classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'node_classes.py')
-rw-r--r--node_classes.py7
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