Message280935
> 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? |
|
Date |
User |
Action |
Args |
2016-11-16 11:26:13 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, vstinner, ezio.melotti, methane, python-dev, josh.r, xiang.zhang |
2016-11-16 11:26:13 | serhiy.storchaka | set | messageid: <1479295573.28.0.930781722978.issue28701@psf.upfronthosting.co.za> |
2016-11-16 11:26:13 | serhiy.storchaka | link | issue28701 messages |
2016-11-16 11:26:13 | serhiy.storchaka | create | |
|