Serhiy Storchaka added the comment: > Can you please also document the behaviour if you pass two non-ASCII strings > which are equal?
What mean "equal"? The left argument is a Unicode string, but the right argument is a byte string. For comparing them we should decode right argument or encode left argument. The result depends on using encoding. _PyUnicode_EqualToASCIIString() uses ASCII (as shown from its name). Non-ASCII strings can't be equal. This is documented. If the documentation is not clear, could you provide better wording? > Maybe the API should be more strict and require right to be ASCII: "right > string must be encoded to ASCII". I expect an assertion error or a fatal > error if right is non-ASCII when Python is compiled in debug mode. I hesitated about adding an assertion error or a fatal error in a bug fix. But this can be added in develop version. I don't know what is better -- return 0 in all builds or return 0 in release build and crash in debug build? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28701> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com