diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-07 00:43:05 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-07 00:43:05 +0100 |
| commit | 53e9ec48e53840d2af24d7262908e6fc9837e856 (patch) | |
| tree | 478e4dfbe1489a45b4a0c67c5247ca8d6430209f | |
| parent | ad14ccd047022d09f486d2359a342ffc5e676e5a (diff) | |
| download | cpython-git-53e9ec48e53840d2af24d7262908e6fc9837e856.tar.gz | |
Issue #19512: Use the new _PyId_builtins identifier
| -rw-r--r-- | Modules/_lsprof.c | 2 | ||||
| -rw-r--r-- | Objects/object.c | 8 | ||||
| -rw-r--r-- | Python/import.c | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index 894788916d..3ef7d65e49 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -185,7 +185,7 @@ normalizeUserObj(PyObject *obj) } } 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); diff --git a/Objects/object.c b/Objects/object.c index 80786239fe..9d96e86c58 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1122,8 +1122,12 @@ PyObject_SelfIter(PyObject *obj) 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); diff --git a/Python/import.c b/Python/import.c index c96106f373..aea29e28f3 100644 --- a/Python/import.c +++ b/Python/import.c @@ -310,7 +310,7 @@ PyImport_Cleanup(void) /* 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) |
