On 18/12/2011 21:04, "Martin v. Löwis" wrote:
PyUnicode_KIND() only returns PyUnicode_1BYTE_KIND, PyUnicode_2BYTE_KIND
or PyUnicode_4BYTE_KIND. Outside unicodeobject.c, you are not supposed
to see PyUnicode_WCHAR_KIND.
Why do you say that? It can very well happen, assuming you call
PyUnicode_KIND on a string that is not ready. That would be a
bug in the module, but people do make bugs when programming.
I added assert(PyUnicode_IS_READY(op)) to the macro, so the bug will be
quickly catched in debug mode. I forgot that it is just an assertion and
few people use Python compiled in debug mode.
If the rationale is to simplify silencing compiler errors, I
vote for reverting the enumeration back to a macro list.
I'm not sure that gcc will not complain if only 3 values are handled. I
agree to revert the commit if that helps developers to write bugs.
Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com