Issue #3080: Use PyUnicode_InternFromString() for builtins

_PyImport_FixupBuiltin() and _PyImport_FindBuiltin() use
PyUnicode_InternFromString() instead of PyUnicode_FromString().
This commit is contained in:
Victor Stinner 2011-03-07 18:28:15 +01:00
parent 9587286f98
commit 21fcd0c9af
1 changed files with 2 additions and 2 deletions

View File

@ -625,7 +625,7 @@ _PyImport_FixupBuiltin(PyObject *mod, char *name)
{ {
int res; int res;
PyObject *nameobj; PyObject *nameobj;
nameobj = PyUnicode_FromString(name); nameobj = PyUnicode_InternFromString(name);
if (nameobj == NULL) if (nameobj == NULL)
return -1; return -1;
res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj); res = _PyImport_FixupExtensionObject(mod, nameobj, nameobj);
@ -681,7 +681,7 @@ PyObject *
_PyImport_FindBuiltin(const char *name) _PyImport_FindBuiltin(const char *name)
{ {
PyObject *res, *nameobj; PyObject *res, *nameobj;
nameobj = PyUnicode_FromString(name); nameobj = PyUnicode_InternFromString(name);
if (nameobj == NULL) if (nameobj == NULL)
return NULL; return NULL;
res = _PyImport_FindExtensionObject(nameobj, nameobj); res = _PyImport_FindExtensionObject(nameobj, nameobj);