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 Dennis Sweeney
Recipients Antony.Lee, Dennis Sweeney
Date 2020-04-19.07:37:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587281879.89.0.903921208218.issue40313@roundup.psfhosted.org>
In-reply-to
Content
I replicated this behavior. This looks like the relevant loop in pystrhex.c:

    for (i=j=0; i < arglen; ++i) {
        assert((j + 1) < resultlen);
        unsigned char c;
        c = (argbuf[i] >> 4) & 0x0f;
        retbuf[j++] = Py_hexdigits[c];
        c = argbuf[i] & 0x0f;
        retbuf[j++] = Py_hexdigits[c];
        if (bytes_per_sep_group && i < arglen - 1) {
            Py_ssize_t anchor;
            anchor = (bytes_per_sep_group > 0) ? (arglen - 1 - i) : (i + 1);
            if (anchor % abs_bytes_per_sep == 0) {
                retbuf[j++] = sep_char;
            }
        }
    }

It looks like this can be refactored a bit for a tighter inner loop with fewer if-tests. I can work on a PR.
History
Date User Action Args
2020-04-19 07:37:59Dennis Sweeneysetrecipients: + Dennis Sweeney, Antony.Lee
2020-04-19 07:37:59Dennis Sweeneysetmessageid: <1587281879.89.0.903921208218.issue40313@roundup.psfhosted.org>
2020-04-19 07:37:59Dennis Sweeneylinkissue40313 messages
2020-04-19 07:37:59Dennis Sweeneycreate