Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects
Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 6069e41..6eb0ee7 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1553,7 +1553,7 @@
kwlist, &sep, &end, &file, &flush))
return NULL;
if (file == NULL || file == Py_None) {
- file = PySys_GetObject("stdout");
+ file = _PySys_GetObjectId(&_PyId_stdout);
if (file == NULL) {
PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
return NULL;
@@ -1638,9 +1638,9 @@
builtin_input(PyObject *self, PyObject *args)
{
PyObject *promptarg = NULL;
- PyObject *fin = PySys_GetObject("stdin");
- PyObject *fout = PySys_GetObject("stdout");
- PyObject *ferr = PySys_GetObject("stderr");
+ PyObject *fin = _PySys_GetObjectId(&_PyId_stdin);
+ PyObject *fout = _PySys_GetObjectId(&_PyId_stdout);
+ PyObject *ferr = _PySys_GetObjectId(&_PyId_stderr);
PyObject *tmp;
long fd;
int tty;