diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-10-10 16:11:30 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-10-10 16:11:30 (GMT) |
commit | 1ee1b6fe0dd7baca0da50e365929d03d42128705 (patch) | |
tree | ae048787548a8915d3e75054a950f710ed521d84 /Objects/fileobject.c | |
parent | 794d567b173e4cc10ad233aeb8743283ea9c3e6b (diff) | |
download | cpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.zip cpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.tar.gz cpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.tar.bz2 |
Use identifier API for PyObject_GetAttrString.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index f3006d0..324e2ee 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -59,8 +59,9 @@ PyFile_GetLine(PyObject *f, int n) { PyObject *reader; PyObject *args; + _Py_identifier(readline); - reader = PyObject_GetAttrString(f, "readline"); + reader = _PyObject_GetAttrId(f, &PyId_readline); if (reader == NULL) return NULL; if (n <= 0) @@ -127,11 +128,13 @@ int PyFile_WriteObject(PyObject *v, PyObject *f, int flags) { PyObject *writer, *value, *args, *result; + _Py_identifier(write); + if (f == NULL) { PyErr_SetString(PyExc_TypeError, "writeobject with NULL file"); return -1; } - writer = PyObject_GetAttrString(f, "write"); + writer = _PyObject_GetAttrId(f, &PyId_write); if (writer == NULL) return -1; if (flags & Py_PRINT_RAW) { @@ -194,11 +197,12 @@ PyObject_AsFileDescriptor(PyObject *o) { int fd; PyObject *meth; + _Py_identifier(fileno); if (PyLong_Check(o)) { fd = PyLong_AsLong(o); } - else if ((meth = PyObject_GetAttrString(o, "fileno")) != NULL) + else if ((meth = _PyObject_GetAttrId(o, &PyId_fileno)) != NULL) { PyObject *fno = PyEval_CallObject(meth, NULL); Py_DECREF(meth); |