summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.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/exceptions.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/exceptions.c')
-rw-r--r--Objects/exceptions.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index e165528..9d61a9a 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -58,9 +58,8 @@ BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds))
return -1;
- Py_DECREF(self->args);
- self->args = args;
- Py_INCREF(self->args);
+ Py_INCREF(args);
+ Py_SETREF(self->args, args);
if (PyTuple_GET_SIZE(self->args) == 1) {
Py_CLEAR(self->message);
@@ -627,8 +626,7 @@ EnvironmentError_init(PyEnvironmentErrorObject *self, PyObject *args,
if (!subslice)
return -1;
- Py_DECREF(self->args); /* replacing args */
- self->args = subslice;
+ Py_SETREF(self->args, subslice);
}
return 0;
}