Commit 7793d158 authored by Guido van Rossum's avatar Guido van Rossum

Intern the strings created in getattr() and setattr().

parent 1ec05f79
...@@ -335,7 +335,7 @@ getattr(v, name) ...@@ -335,7 +335,7 @@ getattr(v, name)
{ {
if (v->ob_type->tp_getattro != NULL) { if (v->ob_type->tp_getattro != NULL) {
object *w, *res; object *w, *res;
w = newstringobject(name); w = PyString_InternFromString(name);
if (w == NULL) if (w == NULL)
return NULL; return NULL;
res = (*v->ob_type->tp_getattro)(v, w); res = (*v->ob_type->tp_getattro)(v, w);
...@@ -375,7 +375,7 @@ setattr(v, name, w) ...@@ -375,7 +375,7 @@ setattr(v, name, w)
if (v->ob_type->tp_setattro != NULL) { if (v->ob_type->tp_setattro != NULL) {
object *s; object *s;
int res; int res;
s = newstringobject(name); s = PyString_InternFromString(name);
if (s == NULL) if (s == NULL)
return -1; return -1;
res = (*v->ob_type->tp_setattro)(v, s, w); res = (*v->ob_type->tp_setattro)(v, s, w);
......
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