Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 86974:954167ce92a3
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.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Wed, 06 Nov 2013 22:41:44 +0100 |
| parents | e5476ecb8b57 |
| children | 40c73ccaee95 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Wed Nov 06 22:40:41 2013 +0100 +++ b/Python/bltinmodule.c Wed Nov 06 22:41:44 2013 +0100 @@ -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;
