Re: [Python-Dev] [Python-checkins] cpython: Fix PyUnicode_Substring() for start = length and start end

2012-05-02 Thread Nick Coghlan
On Thu, May 3, 2012 at 10:33 AM, victor.stinner
python-check...@python.org wrote:
 +    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   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Fix PyUnicode_Substring() for start = length and start end

2012-05-02 Thread Victor Stinner
 +    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
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com