}
}
if (modname != NULL) {
- if (PyUnicode_CompareWithASCIIString(modname, "builtins") != 0) {
+ if (_PyUnicode_CompareWithId(modname, &_PyId_builtins) != 0) {
PyObject *result;
result = PyUnicode_FromFormat("<%U.%s>", modname,
fn->m_ml->ml_name);
PyObject *
_PyObject_GetBuiltin(const char *name)
{
- PyObject *mod, *attr;
- mod = PyImport_ImportModule("builtins");
+ PyObject *mod_name, *mod, *attr;
+
+ mod_name = _PyUnicode_FromId(&_PyId_builtins); /* borrowed */
+ if (mod_name == NULL)
+ return NULL;
+ mod = PyImport_Import(mod_name);
if (mod == NULL)
return NULL;
attr = PyObject_GetAttrString(mod, name);
/* XXX Perhaps these precautions are obsolete. Who knows? */
- value = PyDict_GetItemString(modules, "builtins");
+ value = _PyDict_GetItemId(modules, &_PyId_builtins);
if (value != NULL && PyModule_Check(value)) {
dict = PyModule_GetDict(value);
if (Py_VerboseFlag)