summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-10-10 16:11:30 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-10-10 16:11:30 (GMT)
commit1ee1b6fe0dd7baca0da50e365929d03d42128705 (patch)
treeae048787548a8915d3e75054a950f710ed521d84 /Python/sysmodule.c
parent794d567b173e4cc10ad233aeb8743283ea9c3e6b (diff)
downloadcpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.zip
cpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.tar.gz
cpython-1ee1b6fe0dd7baca0da50e365929d03d42128705.tar.bz2
Use identifier API for PyObject_GetAttrString.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index f0acead..5195a4a 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -79,8 +79,10 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o)
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 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o)
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 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
{
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;