]> granicus.if.org Git - python/commitdiff
Intern the strings created in getattr() and setattr().
authorGuido van Rossum <guido@python.org>
Sat, 18 Jan 1997 07:57:16 +0000 (07:57 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 18 Jan 1997 07:57:16 +0000 (07:57 +0000)
Objects/object.c

index 0af31babaaa3f6d0cf7b9af055ab1db29eaee2a7..fc1d086fe3ab66aa3a1576c22918fb6f8b269948 100644 (file)
@@ -335,7 +335,7 @@ getattr(v, name)
 {
        if (v->ob_type->tp_getattro != NULL) {
                object *w, *res;
-               w = newstringobject(name);
+               w = PyString_InternFromString(name);
                if (w == NULL)
                        return NULL;
                res = (*v->ob_type->tp_getattro)(v, w);
@@ -375,7 +375,7 @@ setattr(v, name, w)
        if (v->ob_type->tp_setattro != NULL) {
                object *s;
                int res;
-               s = newstringobject(name);
+               s = PyString_InternFromString(name);
                if (s == NULL)
                        return -1;
                res = (*v->ob_type->tp_setattro)(v, s, w);