diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-10-09 08:38:36 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-10-09 08:38:36 (GMT) |
commit | afe55bba33a20f87a58f940186359237064b428f (patch) | |
tree | 66d64a1518d79c3d0e90c0a1d0080cd88e887d99 /Python/bltinmodule.c | |
parent | 67df285a3389c7fdb8c7bd301314ac45e17f8074 (diff) | |
download | cpython-afe55bba33a20f87a58f940186359237064b428f.zip cpython-afe55bba33a20f87a58f940186359237064b428f.tar.gz cpython-afe55bba33a20f87a58f940186359237064b428f.tar.bz2 |
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 04f5231..c174e9d 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -32,6 +32,9 @@ const char *Py_FileSystemDefaultEncoding = NULL; /* set by initfsencoding() */ int Py_HasFileSystemDefaultEncoding = 0; #endif +_Py_identifier(fileno); +_Py_identifier(flush); + static PyObject * builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds) { @@ -1567,7 +1570,7 @@ builtin_input(PyObject *self, PyObject *args) } /* First of all, flush stderr */ - tmp = PyObject_CallMethod(ferr, "flush", ""); + tmp = _PyObject_CallMethodId(ferr, &PyId_flush, ""); if (tmp == NULL) PyErr_Clear(); else @@ -1576,7 +1579,7 @@ builtin_input(PyObject *self, PyObject *args) /* We should only use (GNU) readline if Python's sys.stdin and sys.stdout are the same as C's stdin and stdout, because we need to pass it those. */ - tmp = PyObject_CallMethod(fin, "fileno", ""); + tmp = _PyObject_CallMethodId(fin, &PyId_fileno, ""); if (tmp == NULL) { PyErr_Clear(); tty = 0; @@ -1589,7 +1592,7 @@ builtin_input(PyObject *self, PyObject *args) tty = fd == fileno(stdin) && isatty(fd); } if (tty) { - tmp = PyObject_CallMethod(fout, "fileno", ""); + tmp = _PyObject_CallMethodId(fout, &PyId_fileno, ""); if (tmp == NULL) PyErr_Clear(); else { @@ -1621,7 +1624,7 @@ builtin_input(PyObject *self, PyObject *args) Py_DECREF(stdin_encoding); return NULL; } - tmp = PyObject_CallMethod(fout, "flush", ""); + tmp = _PyObject_CallMethodId(fout, &PyId_flush, ""); if (tmp == NULL) PyErr_Clear(); else @@ -1703,7 +1706,7 @@ builtin_input(PyObject *self, PyObject *args) if (PyFile_WriteObject(promptarg, fout, Py_PRINT_RAW) != 0) return NULL; } - tmp = PyObject_CallMethod(fout, "flush", ""); + tmp = _PyObject_CallMethodId(fout, &PyId_flush, ""); if (tmp == NULL) PyErr_Clear(); else |