mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Issue #19512: fileio_init() reuses PyId_name identifier instead of "name"
literal string
This commit is contained in:
parent
ae9f161b43
commit
d9d0419a9f
1 changed files with 3 additions and 2 deletions
|
|
@ -59,6 +59,8 @@ typedef struct {
|
||||||
|
|
||||||
PyTypeObject PyFileIO_Type;
|
PyTypeObject PyFileIO_Type;
|
||||||
|
|
||||||
|
_Py_IDENTIFIER(name);
|
||||||
|
|
||||||
#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type))
|
#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type))
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -427,7 +429,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
|
||||||
_setmode(self->fd, O_BINARY);
|
_setmode(self->fd, O_BINARY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
|
if (_PyObject_SetAttrId((PyObject *)self, &PyId_name, nameobj) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (self->appending) {
|
if (self->appending) {
|
||||||
|
|
@ -1036,7 +1038,6 @@ mode_string(fileio *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
fileio_repr(fileio *self)
|
fileio_repr(fileio *self)
|
||||||
{
|
{
|
||||||
_Py_IDENTIFIER(name);
|
|
||||||
PyObject *nameobj, *res;
|
PyObject *nameobj, *res;
|
||||||
|
|
||||||
if (self->fd < 0)
|
if (self->fd < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue