summaryrefslogtreecommitdiff
path: root/node_classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'node_classes.py')
-rw-r--r--node_classes.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/node_classes.py b/node_classes.py
index e3f1c8db..b6ab6099 100644
--- a/node_classes.py
+++ b/node_classes.py
@@ -893,18 +893,19 @@ _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
+ # XXX we should probably be stricter here and only consider stuff in
+ # CONST_CLS or do better treatment:
+ #
+ # * shall we really support nodes as argument? if so, detail cases where
+ # * this may occurs
+ #
+ # * in case where value is not in CONST_CLS, we should rather recall the
+ # builder on this value than returning an empty node
if isinstance(value, NodeNG):
return value
try:
return CONST_CLS[value.__class__](value)
except (KeyError, AttributeError):
- # some constants (like from gtk._gtk) don't have their class in
- # CONST_CLS, though we can "assert isinstance(value, tuple(CONST_CLS))"
- if isinstance(value, tuple(CONST_CLS)):
- return Const(value)
node = EmptyNode()
node.object = value
return node