interned string created by "string"[i]. Since they're immortal anyway,
this was hard to notice, but it was still wrong <wink>.
static PyObject *
string_item(PyStringObject *a, register int i)
{
- int c;
PyObject *v;
char *pchar;
if (i < 0 || i >= a->ob_size) {
return NULL;
}
pchar = a->ob_sval + i;
- c = *pchar & UCHAR_MAX;
- v = (PyObject *) characters[c];
+ v = (PyObject *)characters[*pchar & UCHAR_MAX];
if (v == NULL)
v = PyString_FromStringAndSize(pchar, 1);
- Py_XINCREF(v);
+ else
+ Py_INCREF(v);
return v;
}