Eric Smith <e...@trueblade.com> added the comment:

Could you add a comment on why you're calling PyUnicode_FromString and then 
throwing away the result? I believe it's so you'll get the same error checking 
as PyUnicode_FromString, but it's sufficiently tricky that I think it deserves 
a comment.

Now that I think about it, having done the conversion in PyUnicode_FromString, 
why not use:
buf[0] = PyUnicode_AS_UNICODE(s)[0];
? This way you skip the cast and you know for a fact you're using the same 
interpretation as PyUnicode_FromString, having used its output.

Also, since you know the size you may as well call PyUnicode_FromStringAndSize. 
It's trivially faster and makes the intent clearer, I think.

----------

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

Reply via email to