diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-01 19:18:27 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-07-01 19:18:27 +0300 |
commit | e549994ed3d51ab7e7103f8705584a6f3895ea81 (patch) | |
tree | fab83f539fc551f443174234086d4e9d0b154736 /astroid/node_classes.py | |
parent | 2eed56e96aaa90e9ce90404afd4833a527f44dd7 (diff) | |
download | astroid-e549994ed3d51ab7e7103f8705584a6f3895ea81.tar.gz |
Add support for indexing bytes on Python 3.
Diffstat (limited to 'astroid/node_classes.py')
-rw-r--r-- | astroid/node_classes.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index bf3a9e4..832936e 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -546,6 +546,11 @@ class Const(NodeNG, Instance): def getitem(self, index, context=None): if isinstance(self.value, six.string_types): return Const(self.value[index]) + if isinstance(self.value, bytes) and six.PY3: + # Bytes aren't instances of six.string_types + # on Python 3. Also, indexing them should return + # integers. + return Const(self.value[index]) raise TypeError('%r (value=%s)' % (self, self.value)) def has_dynamic_getattr(self): |