summaryrefslogtreecommitdiff
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-24 10:35:59 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-24 10:35:59 +0200
commit5a57ade58ec5bee85db41b8ce1340ff077781b65 (patch)
tree2f8cf61efba46284b2d4437916bc3469d23c0ce3 /Modules/faulthandler.c
parenta198645fa0f9a9c6183c211955083765dc8ab3a8 (diff)
downloadcpython-git-5a57ade58ec5bee85db41b8ce1340ff077781b65.tar.gz
Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 530ddc7efd..1ed22bf8bc 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -380,9 +380,8 @@ faulthandler_enable(PyObject *self, PyObject *args, PyObject *kwargs)
if (tstate == NULL)
return NULL;
- Py_XDECREF(fatal_error.file);
Py_XINCREF(file);
- fatal_error.file = file;
+ Py_SETREF(fatal_error.file, file);
fatal_error.fd = fd;
fatal_error.all_threads = all_threads;
fatal_error.interp = tstate->interp;
@@ -599,9 +598,8 @@ faulthandler_dump_traceback_later(PyObject *self,
/* Cancel previous thread, if running */
cancel_dump_traceback_later();
- Py_XDECREF(thread.file);
Py_XINCREF(file);
- thread.file = file;
+ Py_SETREF(thread.file, file);
thread.fd = fd;
thread.timeout_us = timeout_us;
thread.repeat = repeat;
@@ -778,9 +776,8 @@ faulthandler_register_py(PyObject *self,
user->previous = previous;
}
- Py_XDECREF(user->file);
Py_XINCREF(file);
- user->file = file;
+ Py_SETREF(user->file, file);
user->fd = fd;
user->all_threads = all_threads;
user->chain = chain;