summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-06 22:50:10 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-06 22:50:10 (GMT)
commitd9d0419a9fc85d1f4c8744f68156fd6b305d5ff0 (patch)
tree6ced4710eb20f0c4b20d17b5f4d574fc5c039726 /Modules/_io
parentae9f161b43df37e69ba4715b50862fdbf077e245 (diff)
downloadcpython-d9d0419a9fc85d1f4c8744f68156fd6b305d5ff0.zip
cpython-d9d0419a9fc85d1f4c8744f68156fd6b305d5ff0.tar.gz
cpython-d9d0419a9fc85d1f4c8744f68156fd6b305d5ff0.tar.bz2
Issue #19512: fileio_init() reuses PyId_name identifier instead of "name"
literal string
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/fileio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 27995e5..0e1e709 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -59,6 +59,8 @@ typedef struct {
PyTypeObject PyFileIO_Type;
+_Py_IDENTIFIER(name);
+
#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type))
int
@@ -427,7 +429,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
_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 @@ mode_string(fileio *self)
static PyObject *
fileio_repr(fileio *self)
{
- _Py_IDENTIFIER(name);
PyObject *nameobj, *res;
if (self->fd < 0)