From: Stefan Behnel Date: Sun, 6 Feb 2011 15:14:48 +0000 (+0100) Subject: when indexing/slicing 'str', it's safe to infer 'str' for the result X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3dc2263ef9dfa2f06605fde4dc42d642ada1505c;p=cython.git when indexing/slicing 'str', it's safe to infer 'str' for the result --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 07b0db22..86a26c7c 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2087,8 +2087,8 @@ class IndexNode(ExprNode): return base_type.base_type # may be slicing or indexing, we don't know - if base_type is unicode_type: - # this type always returns its own type on Python indexing/slicing + if base_type in (unicode_type, str_type): + # these types always returns their own type on Python indexing/slicing return base_type else: # TODO: Handle buffers (hopefully without too much redundancy).