[Python-Dev] [Python-checkins] cpython: Optimize string slicing to use the new API (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Tue Oct 4 20:09:06 CEST 2011
- Previous message: [Python-Dev] [Python-checkins] cpython: Optimize string slicing to use the new API
- Next message: [Python-Dev] [Python-checkins] cpython: Optimize string slicing to use the new API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 04.10.11 19:50, schrieb Antoine Pitrou:
On Tue, 04 Oct 2011 19:49:09 +0200 "Martin v. Löwis"<martin at v.loewis.de> wrote:
+ result = PyUnicodeNew(slicelength, PyUnicodeMAXCHARVALUE(self)); This is incorrect: the maxchar of the slice might be smaller than the maxchar of the input string. I thought that heuristic would be good enough. I'll try to fix it.
No - strings must always be in the canonical form. For example, PyUnicode_RichCompare considers string unequal if they have different kinds. As a consequence, your slice result may not compare equal to a canonical variant of itself.
- Previous message: [Python-Dev] [Python-checkins] cpython: Optimize string slicing to use the new API
- Next message: [Python-Dev] [Python-checkins] cpython: Optimize string slicing to use the new API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]