py3: Fix positions for non-BMP chars in the matcher

All tests now pass on python3
This commit is contained in:
Kovid Goyal 2019-04-15 20:12:18 +05:30
parent c8355e17b2
commit 4f1a6c16c6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -164,7 +164,7 @@ static void convert_positions(int32_t *positions, int32_t *final_positions, UCha
for (i = 0; i < byte_len && final_positions < end; i++) {
if (positions[i] == -1) continue;
#if PY_VERSION_HEX >= 0x03030000
*final_positions = positions[i];
*final_positions = u_countChar32(string, positions[i]);
#else
#ifdef Py_UNICODE_WIDE
*final_positions = u_countChar32(string, positions[i]);
@ -538,4 +538,4 @@ CALIBRE_MODINIT_FUNC initmatcher(void) {
#if PY_MAJOR_VERSION >= 3
return mod;
#endif
}
}