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 belopolsky
Recipients Arfrever, amaury.forgeotdarc, belopolsky, ezio.melotti, lemburg, loewis, ronaldoussoren, vstinner
Date 2010-12-06.16:52:28
SpamBayes Score 2.569683e-06
Marked as misclassified No
Message-id <>
One of the uses of problematic uses of PyUnicode_GetSize() is in Macintosh Gestalt interface:

/* Convert a 4-char string object argument to an OSType value */
static int
convert_to_OSType(PyObject *v, OSType *pr)
    uint32_t tmp;
    if (!PyUnicode_Check(v) || PyUnicode_GetSize(v) != 4) {
                    "OSType arg must be string of 4 chars");
    return 0;
    memcpy((char *)&tmp, _PyUnicode_AsString(v), 4);
    *pr = (OSType)ntohl(tmp);
    return 1;


This function seems to require a bytes, not str argument as interpreting 4 UTF-8 bytes as an int makes little sense.
Date User Action Args
2010-12-06 16:52:30belopolskysetrecipients: + belopolsky, lemburg, loewis, ronaldoussoren, amaury.forgeotdarc, vstinner, ezio.melotti, Arfrever
2010-12-06 16:52:30belopolskysetmessageid: <>
2010-12-06 16:52:28belopolskylinkissue6697 messages
2010-12-06 16:52:28belopolskycreate