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 Dennis Sweeney, pieter.eendebak
Date 2022-03-19.23:09:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'd bet we could add a couple of utility functions that could be used in multiple places, to keep the "trick" all in one place. Something like

_PyBytes_RepeatInPlace(char **buffer, size_t start_len, size_t end_len)
    // Repeatedly double.
    size_t copied = start_len;
    while (copied < end_len) {
        size_t to_copy = Py_MIN(copied, end_len - copied);
        memcpy(buffer + copied, buffer, to_copy);
        copied += to_copy;

_PyBytes_Repeat(char *dest, size_t len_dest,
                const char *src, size_t len_src)
    // XXX maybe handle zero lengths
    // XXX maybe use memset for len_src == 1
    memcpy(dest, src, len_src);
    _PyBytes_RepeatInPlace(dest, len_src, len_dest);
Date User Action Args
2022-03-19 23:09:13Dennis Sweeneysetrecipients: + Dennis Sweeney, pieter.eendebak
2022-03-19 23:09:13Dennis Sweeneysetmessageid: <>
2022-03-19 23:09:13Dennis Sweeneylinkissue47070 messages
2022-03-19 23:09:12Dennis Sweeneycreate