Author rhettinger
Recipients eric.smith, nanjekyejoannah, pablogsal, rhettinger, terry.reedy
Date 2022-01-06.20:42:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641501756.17.0.569188389501.issue46280@roundup.psfhosted.org>
In-reply-to
Content
#511 and #512 are false positives.  The "kind" variable is indeed uninitialized in the bytes_writer case:

    else if (bytes_writer) {
        *bytes_str = _PyBytesWriter_Prepare(bytes_writer, *bytes_str, strlen);
        if (*bytes_str == NULL) {
            Py_DECREF(scratch);
            return -1;
        }
    }

However, the flagged sections cannot be called in the bytes_writer case:

    if (bytes_writer) {                  <=="kind" not used here
        char *p = *bytes_str + strlen;
        WRITE_DIGITS(p);
        assert(p == *bytes_str);
    }
    else if (kind == PyUnicode_1BYTE_KIND) {  <== bytes_write is false
        Py_UCS1 *p;
        WRITE_UNICODE_DIGITS(Py_UCS1);
    }
    else if (kind == PyUnicode_2BYTE_KIND) {  <== bytes_write is false
        Py_UCS2 *p;
        WRITE_UNICODE_DIGITS(Py_UCS2);
    }
    else {
        Py_UCS4 *p;
        assert (kind == PyUnicode_4BYTE_KIND);
        WRITE_UNICODE_DIGITS(Py_UCS4);
    }
History
Date User Action Args
2022-01-06 20:42:36rhettingersetrecipients: + rhettinger, terry.reedy, eric.smith, pablogsal, nanjekyejoannah
2022-01-06 20:42:36rhettingersetmessageid: <1641501756.17.0.569188389501.issue46280@roundup.psfhosted.org>
2022-01-06 20:42:36rhettingerlinkissue46280 messages
2022-01-06 20:42:36rhettingercreate