diff options
Diffstat (limited to 'node_classes.py')
-rw-r--r-- | node_classes.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/node_classes.py b/node_classes.py index b6ab6099..a4282b62 100644 --- a/node_classes.py +++ b/node_classes.py @@ -894,15 +894,11 @@ _update_const_classes() def const_factory(value): """return an astng node for a python value""" # 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 + # CONST_CLS or do better treatment: in case where value is not in CONST_CLS, + # we should rather recall the builder on this value than returning an empty + # node (another option being that const_factory shouldn't be called with something + # not in CONST_CLS) + assert not isinstance(value, NodeNG) try: return CONST_CLS[value.__class__](value) except (KeyError, AttributeError): |