From 3dc2263ef9dfa2f06605fde4dc42d642ada1505c Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 6 Feb 2011 16:14:48 +0100 Subject: [PATCH] when indexing/slicing 'str', it's safe to infer 'str' for the result --- Cython/Compiler/ExprNodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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). -- 2.26.2