summaryrefslogtreecommitdiff
path: root/node_classes.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2011-09-07 10:23:10 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2011-09-07 10:23:10 +0200
commite44eee868fab3b72f100da3aeae4338215a9b5a0 (patch)
tree1890aedc930714372518fbc573d04f5664080d0f /node_classes.py
parent7d24bf13562c03eace54dd0414abcbbe61675d97 (diff)
downloadastroid-git-e44eee868fab3b72f100da3aeae4338215a9b5a0.tar.gz
closes #74748: getitem protocal should return Const node, not the bare python value
This one is cute. It's a fix for a crash that occurs on code like "any string literal"[0].upper() due to the fact that the extracted string literal is not properly wrapped, but returned as a naked string object. (patch by google)
Diffstat (limited to 'node_classes.py')
-rw-r--r--node_classes.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/node_classes.py b/node_classes.py
index 4dd8520c..607ad907 100644
--- a/node_classes.py
+++ b/node_classes.py
@@ -435,7 +435,7 @@ class Const(NodeNG, Instance):
def getitem(self, index, context=None):
if isinstance(self.value, basestring):
- return self.value[index]
+ return Const(self.value[index])
raise TypeError('%r (value=%s)' % (self, self.value))
def has_dynamic_getattr(self):