This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ezio.melotti, josh.r, methane, python-dev, serhiy.storchaka, vstinner, xiang.zhang
Date 2016-11-16.11:26:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479295573.28.0.930781722978.issue28701@psf.upfronthosting.co.za>
In-reply-to
Content
> 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?
History
Date User Action Args
2016-11-16 11:26:13serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, ezio.melotti, methane, python-dev, josh.r, xiang.zhang
2016-11-16 11:26:13serhiy.storchakasetmessageid: <1479295573.28.0.930781722978.issue28701@psf.upfronthosting.co.za>
2016-11-16 11:26:13serhiy.storchakalinkissue28701 messages
2016-11-16 11:26:13serhiy.storchakacreate