[New-bugs-announce] [issue16281] TODO in tailmatch(): it does not support backward in all cases

STINNER Victor report at bugs.python.org
Fri Oct 19 02:51:23 CEST 2012


New submission from STINNER Victor:

Oh oh, it looks like the implementation of tailmatch() was not finished:

        /* If both are of the same kind, memcmp is sufficient */
        if (kind_self == kind_sub) {
            return ...;
        }
        /* otherwise we have to compare each character by first accesing it */
        else {
            /* We do not need to compare 0 and len(substring)-1 because
               the if statement above ensured already that they are equal
               when we end up here. */
            /* TODO: honor direction and do a forward or backwards search */
            for (i = 1; i < end_sub; ++i) {
                if (PyUnicode_READ(kind_self, data_self, offset + i) !=
                    PyUnicode_READ(kind_sub, data_sub, i))
                    return 0;
            }
            return 1;
        }

----------
messages: 173301
nosy: haypo, loewis, serhiy.storchaka
priority: normal
severity: normal
status: open
title: TODO in tailmatch(): it does not support backward in all cases
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list