I see this as a micro-optimization. IMO we should *not* rely on these
assumptions because we cannot expect that all developers of third party
modules will be able to write perfect code, and some (lazy developers!)
may prefer to use a fixed maximum character (e.g. 0x).
Hmm. I'd like to
+result = PyUnicode_New(slicelength, PyUnicode_MAX_CHAR_VALUE(self));
This is incorrect: the maxchar of the slice might be smaller than the
maxchar of the input string. So you'll need to iterate over the input
string first, compute the maxchar, and then allocate the result string.
Am 04.10.11 19:50, schrieb Antoine Pitrou:
On Tue, 04 Oct 2011 19:49:09 +0200
Martin v. Löwismar...@v.loewis.de wrote:
+result = PyUnicode_New(slicelength, PyUnicode_MAX_CHAR_VALUE(self));
This is incorrect: the maxchar of the slice might be smaller than the
maxchar of the input
Le 04/10/2011 20:09, Martin v. Löwis a écrit :
Am 04.10.11 19:50, schrieb Antoine Pitrou:
On Tue, 04 Oct 2011 19:49:09 +0200
Martin v. Löwismar...@v.loewis.de wrote:
+ result = PyUnicode_New(slicelength, PyUnicode_MAX_CHAR_VALUE(self));
This is incorrect: the maxchar of the slice might be