Re: [Python-Dev] [Python-checkins] cpython: Fix PyUnicode_Substring() for start >= length and start > end
3 May
2012
3 May
'12
6:23 a.m.
On Thu, May 3, 2012 at 10:33 AM, victor.stinner
+ if (start >= length || end < start) { + assert(end == length); + return PyUnicode_New(0, 0); + }
That assert doesn't look right. Consider: "abc"[4:1] Unless I'm missing something, "end" will be 1, but "length" will be 3 Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
3 May
3 May
7:08 a.m.
New subject: [Python-checkins] cpython: Fix PyUnicode_Substring() for start >= length and start > end
+ if (start >= length || end < start) { + assert(end == length); + return PyUnicode_New(0, 0); + }
That assert doesn't look right.
Oh, you're right. I added it for the first case: start>=length. But the assertion is really useless, I removed it. Thanks! Victor
4375
Age (days ago)
4375
Last active (days ago)
1 comments
2 participants
participants (2)
-
Nick Coghlan
-
Victor Stinner