Message366761
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. |
|
Date |
User |
Action |
Args |
2020-04-19 07:37:59 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney, Antony.Lee |
2020-04-19 07:37:59 | Dennis Sweeney | set | messageid: <1587281879.89.0.903921208218.issue40313@roundup.psfhosted.org> |
2020-04-19 07:37:59 | Dennis Sweeney | link | issue40313 messages |
2020-04-19 07:37:59 | Dennis Sweeney | create | |
|