mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #19512: Use the new _PyId_builtins identifier
This commit is contained in:
parent
ad14ccd047
commit
53e9ec48e5
3 changed files with 8 additions and 4 deletions
|
@ -185,7 +185,7 @@ normalizeUserObj(PyObject *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modname != NULL) {
|
if (modname != NULL) {
|
||||||
if (PyUnicode_CompareWithASCIIString(modname, "builtins") != 0) {
|
if (_PyUnicode_CompareWithId(modname, &_PyId_builtins) != 0) {
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
result = PyUnicode_FromFormat("<%U.%s>", modname,
|
result = PyUnicode_FromFormat("<%U.%s>", modname,
|
||||||
fn->m_ml->ml_name);
|
fn->m_ml->ml_name);
|
||||||
|
|
|
@ -1122,8 +1122,12 @@ PyObject_SelfIter(PyObject *obj)
|
||||||
PyObject *
|
PyObject *
|
||||||
_PyObject_GetBuiltin(const char *name)
|
_PyObject_GetBuiltin(const char *name)
|
||||||
{
|
{
|
||||||
PyObject *mod, *attr;
|
PyObject *mod_name, *mod, *attr;
|
||||||
mod = PyImport_ImportModule("builtins");
|
|
||||||
|
mod_name = _PyUnicode_FromId(&_PyId_builtins); /* borrowed */
|
||||||
|
if (mod_name == NULL)
|
||||||
|
return NULL;
|
||||||
|
mod = PyImport_Import(mod_name);
|
||||||
if (mod == NULL)
|
if (mod == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
attr = PyObject_GetAttrString(mod, name);
|
attr = PyObject_GetAttrString(mod, name);
|
||||||
|
|
|
@ -310,7 +310,7 @@ PyImport_Cleanup(void)
|
||||||
|
|
||||||
/* XXX Perhaps these precautions are obsolete. Who knows? */
|
/* 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)) {
|
if (value != NULL && PyModule_Check(value)) {
|
||||||
dict = PyModule_GetDict(value);
|
dict = PyModule_GetDict(value);
|
||||||
if (Py_VerboseFlag)
|
if (Py_VerboseFlag)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue