This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients amaury.forgeotdarc, ezio.melotti, lemburg, pitrou, rhettinger
Date 2011-04-14.11:48:48
SpamBayes Score 1.6167744e-08
Marked as misclassified No
Message-id <4DA6DF1B.2080201@egenix.com>
In-reply-to <1302780725.86.0.482931658963.issue5057@psf.upfronthosting.co.za>
Content
Ezio Melotti wrote:
> 
> Ezio Melotti <ezio.melotti@gmail.com> added the comment:
> 
> The attached patch skips the peepholer optimizations for BINARY_SUBSCR if the resulting char is a surrogate on narrow builds or a non-bmp char in wide builds.
> Note that this affects the optimization of lone surrogates on narrow builds too, but I think it's not worth to adding more complexity on the peepholer and check if they are part of a surrogate pair.
> The patch still lacks comments and could have better tests.

             newconst = PyObject_GetItem(v, w);
+            if (PyUnicode_Check(v)) {
+                Py_UNICODE ch = PyUnicode_AS_UNICODE(newconst)[0];

Without checking, you shouldn't assume that newconst is a PyUnicodeObject.

Other than that the patch looks fine.
History
Date User Action Args
2011-04-14 11:48:49lemburgsetrecipients: + lemburg, rhettinger, amaury.forgeotdarc, pitrou, ezio.melotti
2011-04-14 11:48:48lemburglinkissue5057 messages
2011-04-14 11:48:48lemburgcreate