[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

Serhiy Storchaka report at bugs.python.org
Mon Nov 14 04:20:05 EST 2016


Serhiy Storchaka added the comment:

There are yet few subtle details.

1. _PyUnicode_FromId() uses UTF-8 for decoding from C string, but PyUnicode_CompareWithASCIIString() uses Latin1. Two ways of comparison can return different results. Currently all identifiers are ASCII, thus perhaps we can ignore this issue for a time. Perhaps the simplest solution is to make PyUnicode_FromId() using ASCII or Latin1.

2. PyUnicode_READY() can fail either because Unicode object is misformed or due to MemoryError. The former case is unavoidable error and returning false is good. But the latter can be temporary error and we should add a fallback, compare wchar_t * representation of non-ready Unicode object with char * representation of identifier.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21449>
_______________________________________


More information about the Python-bugs-list mailing list