mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
This commit is contained in:
parent
bd928fef42
commit
1c67dd9b15
12 changed files with 200 additions and 183 deletions
|
@ -139,6 +139,7 @@ sys_displayhook(PyObject *self, PyObject *o)
|
|||
PyObject *modules = interp->modules;
|
||||
PyObject *builtins = PyDict_GetItemString(modules, "builtins");
|
||||
int err;
|
||||
_Py_IDENTIFIER(_);
|
||||
|
||||
if (builtins == NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "lost builtins module");
|
||||
|
@ -152,7 +153,7 @@ sys_displayhook(PyObject *self, PyObject *o)
|
|||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
if (PyObject_SetAttrString(builtins, "_", Py_None) != 0)
|
||||
if (_PyObject_SetAttrId(builtins, &PyId__, Py_None) != 0)
|
||||
return NULL;
|
||||
outf = PySys_GetObject("stdout");
|
||||
if (outf == NULL || outf == Py_None) {
|
||||
|
@ -174,7 +175,7 @@ sys_displayhook(PyObject *self, PyObject *o)
|
|||
}
|
||||
if (PyFile_WriteString("\n", outf) != 0)
|
||||
return NULL;
|
||||
if (PyObject_SetAttrString(builtins, "_", o) != 0)
|
||||
if (_PyObject_SetAttrId(builtins, &PyId__, o) != 0)
|
||||
return NULL;
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue