Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

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

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


ncoghlan at gmail

May 2, 2012, 5:53 PM

Post #1 of 2 (74 views)
Permalink
Re: [Python-checkins] cpython: Fix PyUnicode_Substring() for start >= length and start > end

On Thu, May 3, 2012 at 10:33 AM, victor.stinner
<python-checkins [at] python> 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   |   ncoghlan [at] gmail   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


victor.stinner at gmail

May 2, 2012, 6:38 PM

Post #2 of 2 (63 views)
Permalink
Re: [Python-checkins] cpython: Fix PyUnicode_Substring() for start >= length and start > end [In reply to]

>> +    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 [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.