summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-24 08:35:35 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-24 08:35:35 (GMT)
commit5951f2300f43d75d344d542e171daed47a0382a6 (patch)
tree2e173dda0c0d4c4bf887e8a6a309430d0d9cd5be /Objects/fileobject.c
parent6ed42ea08b3a961944e94f1dd941ffabc7657065 (diff)
downloadcpython-5951f2300f43d75d344d542e171daed47a0382a6.zip
cpython-5951f2300f43d75d344d542e171daed47a0382a6.tar.gz
cpython-5951f2300f43d75d344d542e171daed47a0382a6.tar.bz2
Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 55e074b..9ae068c 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -574,10 +574,8 @@ PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors)
oerrors = Py_None;
Py_INCREF(Py_None);
}
- Py_DECREF(file->f_encoding);
- file->f_encoding = str;
- Py_DECREF(file->f_errors);
- file->f_errors = oerrors;
+ Py_SETREF(file->f_encoding, str);
+ Py_SETREF(file->f_errors, oerrors);
return 1;
}