Kaydet (Commit) cf5ad5d6 authored tarafından Tim Peters's avatar Tim Peters

My change to string_item() left an extra reference to each 1-character

interned string created by "string"[i].  Since they're immortal anyway,
this was hard to notice, but it was still wrong <wink>.
üst 5b4d4775
...@@ -553,7 +553,6 @@ string_contains(PyObject *a, PyObject *el) ...@@ -553,7 +553,6 @@ string_contains(PyObject *a, PyObject *el)
static PyObject * static PyObject *
string_item(PyStringObject *a, register int i) string_item(PyStringObject *a, register int i)
{ {
int c;
PyObject *v; PyObject *v;
char *pchar; char *pchar;
if (i < 0 || i >= a->ob_size) { if (i < 0 || i >= a->ob_size) {
...@@ -561,11 +560,11 @@ string_item(PyStringObject *a, register int i) ...@@ -561,11 +560,11 @@ string_item(PyStringObject *a, register int i)
return NULL; return NULL;
} }
pchar = a->ob_sval + i; pchar = a->ob_sval + i;
c = *pchar & UCHAR_MAX; v = (PyObject *)characters[*pchar & UCHAR_MAX];
v = (PyObject *) characters[c];
if (v == NULL) if (v == NULL)
v = PyString_FromStringAndSize(pchar, 1); v = PyString_FromStringAndSize(pchar, 1);
Py_XINCREF(v); else
Py_INCREF(v);
return v; return v;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment