mirror of https://github.com/python/cpython
Intern the strings created in getattr() and setattr().
This commit is contained in:
parent
2a61e7428d
commit
c6d0670f1b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue