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 vstinner
Recipients loewis, serhiy.storchaka, vstinner
Date 2012-11-05.11:36:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwZZXkAQKtJLGj4E1Hwu0_89rjrvgAOf_8KfhOz+mLBj6A@mail.gmail.com>
In-reply-to <201211051121.46585.storchaka@gmail.com>
Content
>> Oh, PyUnicode_Tailmatch() documentation doesn't mention that the function
>> can fail.
>
> But it does.
>
> .. c:function:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, \
>                         Py_ssize_t start, Py_ssize_t end, int direction)
>
>    Return 1 if *substr* matches ``str[start:end]`` at the given tail end
>    (*direction* == -1 means to do a prefix match, *direction* == 1 a suffix match),
>    0 otherwise. Return ``-1`` if an error occurred.

Oh, I read the "documentation" in unicodeobject.h:

/* Return 1 if substr matches str[start:end] at the given tail end, 0
   otherwise. */

The problem is that tailmatch() returns 0 if PyUnicode_READY() failed.
It is a bug, even if it cannot occur because PyUnicode_Tailmatch()
checks that the both strings are ready.
History
Date User Action Args
2012-11-05 11:36:08vstinnersetrecipients: + vstinner, loewis, serhiy.storchaka
2012-11-05 11:36:08vstinnerlinkissue16281 messages
2012-11-05 11:36:08vstinnercreate