Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 72848:81380082d216
Use identifier API for PyObject_GetAttrString.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 10 Oct 2011 18:11:30 +0200 |
| parents | 5e33219492bc |
| children | 7109f31300fb |
line wrap: on
line diff
--- a/Python/sysmodule.c Mon Oct 10 03:21:36 2011 +0200 +++ b/Python/sysmodule.c Mon Oct 10 18:11:30 2011 +0200 @@ -79,8 +79,10 @@ PyObject *encoded, *escaped_str, *repr_str, *buffer, *result; char *stdout_encoding_str; int ret; + _Py_identifier(encoding); + _Py_identifier(buffer); - stdout_encoding = PyObject_GetAttrString(outf, "encoding"); + stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding); if (stdout_encoding == NULL) goto error; stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); @@ -97,7 +99,7 @@ if (encoded == NULL) goto error; - buffer = PyObject_GetAttrString(outf, "buffer"); + buffer = _PyObject_GetAttrId(outf, &PyId_buffer); if (buffer) { _Py_identifier(write); result = _PyObject_CallMethodId(buffer, &PyId_write, "(O)", encoded); @@ -1841,11 +1843,12 @@ { PyObject *writer = NULL, *args = NULL, *result = NULL; int err; + _Py_identifier(write); if (file == NULL) return -1; - writer = PyObject_GetAttrString(file, "write"); + writer = _PyObject_GetAttrId(file, &PyId_write); if (writer == NULL) goto error;
