[Python-checkins] cpython: Issue #19512: fileio_init() reuses PyId_name identifier instead of "name"

victor.stinner python-checkins at python.org
Thu Nov 7 00:03:01 CET 2013


http://hg.python.org/cpython/rev/7177363d8c5c
changeset:   86976:7177363d8c5c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Nov 06 23:50:10 2013 +0100
summary:
  Issue #19512: fileio_init() reuses PyId_name identifier instead of "name"
literal string

files:
  Modules/_io/fileio.c |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -59,6 +59,8 @@
 
 PyTypeObject PyFileIO_Type;
 
+_Py_IDENTIFIER(name);
+
 #define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type))
 
 int
@@ -427,7 +429,7 @@
     _setmode(self->fd, O_BINARY);
 #endif
 
-    if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
+    if (_PyObject_SetAttrId((PyObject *)self, &PyId_name, nameobj) < 0)
         goto error;
 
     if (self->appending) {
@@ -1036,7 +1038,6 @@
 static PyObject *
 fileio_repr(fileio *self)
 {
-    _Py_IDENTIFIER(name);
     PyObject *nameobj, *res;
 
     if (self->fd < 0)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list