Message123479
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) {
PyErr_SetString(PyExc_TypeError,
"OSType arg must be string of 4 chars");
return 0;
}
memcpy((char *)&tmp, _PyUnicode_AsString(v), 4);
*pr = (OSType)ntohl(tmp);
return 1;
}
(Modules/_gestalt.c:41)
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:30 | belopolsky | set | recipients:
+ belopolsky, lemburg, loewis, ronaldoussoren, amaury.forgeotdarc, vstinner, ezio.melotti, Arfrever |
2010-12-06 16:52:30 | belopolsky | set | messageid: <1291654350.01.0.246385970547.issue6697@psf.upfronthosting.co.za> |
2010-12-06 16:52:28 | belopolsky | link | issue6697 messages |
2010-12-06 16:52:28 | belopolsky | create | |
|