Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

I am attaching a patch that defines Py_UNICODE_PUT_NEXT() macro (tentative 
name) and uses it to fix str.upper method.  The implementation of 
surrogate-aware str.upper shows that NEXT/PUT_NEXT abstractions may lead to 
somewhat inefficient code for "by codepoint" processing.  The issue is that 
once in in the process of reading the codepoint, it is determined whether the 
code point is BMP or non-BMP.  Testing the result again in order to write it is 
somewhat wasteful.  I don't think this would matter in practice, but would like 
to hear alternative opinions before moving further. (Please, don't argue over 
names - let's figure out the proper semantics first.)

----------
Added file: http://bugs.python.org/file19845/issue10542-put-next.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10542>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to