Issue #20440: Cleaning up the code by using Py_SETREF.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index f784f75..53dd4a1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -436,10 +436,7 @@
         return -1;
     }
     if (result != Py_None) {
-        PyObject *temp = frame->f_trace;
-        frame->f_trace = NULL;
-        Py_XDECREF(temp);
-        frame->f_trace = result;
+        Py_SETREF(frame->f_trace, result);
     }
     else {
         Py_DECREF(result);