mirror of
https://github.com/python/cpython.git
synced 2025-09-06 08:51:39 +00:00
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.
This commit is contained in:
parent
bb52020d44
commit
090543736f
13 changed files with 72 additions and 49 deletions
|
@ -1553,7 +1553,7 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
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 @@ static PyObject *
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue