Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 1b804ae..7e20301 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -391,7 +391,7 @@
         Py_DECREF((PyObject *)dict);
         return NULL;
     }
-    Py_XSETREF(result->tp_dict, (PyObject *)dict);
+    Py_SETREF(result->tp_dict, (PyObject *)dict);
     dict->format = _ctypes_alloc_format_string(NULL, "B");
     if (dict->format == NULL) {
         Py_DECREF(result);
@@ -960,7 +960,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -1403,7 +1403,7 @@
     /* replace the class dict by our updated spam dict */
     if (-1 == PyDict_Update((PyObject *)stgdict, result->tp_dict))
         goto error;
-    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);  /* steal the reference */
+    Py_SETREF(result->tp_dict, (PyObject *)stgdict);  /* steal the reference */
     stgdict = NULL;
 
     /* Special case for character arrays.
@@ -1816,7 +1816,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
 
     return (PyObject *)result;
 }
@@ -1944,7 +1944,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
 
     /* Install from_param class methods in ctypes base classes.
        Overrides the PyCSimpleType_from_param generic method.
@@ -2307,7 +2307,7 @@
         Py_DECREF((PyObject *)stgdict);
         return NULL;
     }
-    Py_XSETREF(result->tp_dict, (PyObject *)stgdict);
+    Py_SETREF(result->tp_dict, (PyObject *)stgdict);
 
     if (-1 == make_funcptrtype_dict(stgdict)) {
         Py_DECREF(result);
@@ -5152,7 +5152,7 @@
 
     bself = (PyBaseExceptionObject *)self;
     Py_INCREF(args);
-    Py_XSETREF(bself->args, args);
+    Py_SETREF(bself->args, args);
 
     return 0;
 }
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 75bbb17..759b731 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -313,7 +313,7 @@
         return NULL;
     }
     Py_INCREF(temp);
-    Py_XSETREF(po->wo, temp);
+    Py_SETREF(po->wo, temp);
     Py_INCREF(Py_None);
     return Py_None;
 }
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 6619048..0f1d6a1 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -1943,7 +1943,7 @@
 
     if (strcmp(name, "tag") == 0) {
         Py_INCREF(value);
-        Py_XSETREF(self->tag, value);
+        Py_SETREF(self->tag, value);
     } else if (strcmp(name, "text") == 0) {
         Py_DECREF(JOIN_OBJ(self->text));
         self->text = value;
@@ -1958,7 +1958,7 @@
                 return -1;
         }
         Py_INCREF(value);
-        Py_XSETREF(self->extra->attrib, value);
+        Py_SETREF(self->extra->attrib, value);
     } else {
         PyErr_SetString(PyExc_AttributeError,
             "Can't set arbitrary attributes on Element");
@@ -2551,9 +2551,9 @@
     self->index++;
 
     Py_INCREF(node);
-    Py_XSETREF(self->this, node);
+    Py_SETREF(self->this, node);
     Py_INCREF(node);
-    Py_XSETREF(self->last, node);
+    Py_SETREF(self->last, node);
 
     if (treebuilder_append_event(self, self->start_event_obj, node) < 0)
         goto error;
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 42e4158..7570624 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -204,7 +204,7 @@
         node = node->next;
     }
 
-    Py_XSETREF(self->statement_cache,
+    Py_SETREF(self->statement_cache,
               (pysqlite_Cache *)PyObject_CallFunction((PyObject *)&pysqlite_CacheType, "O", self));
     Py_DECREF(self);
     self->statement_cache->decref_factory = 0;
@@ -794,7 +794,7 @@
         }
     }
 
-    Py_XSETREF(self->statements, new_list);
+    Py_SETREF(self->statements, new_list);
 }
 
 static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
@@ -825,7 +825,7 @@
         }
     }
 
-    Py_XSETREF(self->cursors, new_list);
+    Py_SETREF(self->cursors, new_list);
 }
 
 PyObject* pysqlite_connection_create_function(pysqlite_Connection* self, PyObject* args, PyObject* kwargs)
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 0931c84..300da28 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -510,7 +510,7 @@
 
     /* reset description and rowcount */
     Py_INCREF(Py_None);
-    Py_XSETREF(self->description, Py_None);
+    Py_SETREF(self->description, Py_None);
     self->rowcount = -1L;
 
     func_args = PyTuple_New(1);
@@ -535,7 +535,7 @@
     }
 
     if (self->statement->in_use) {
-        Py_XSETREF(self->statement,
+        Py_SETREF(self->statement,
                   PyObject_New(pysqlite_Statement, &pysqlite_StatementType));
         if (!self->statement) {
             goto error;
@@ -652,7 +652,7 @@
                 numcols = sqlite3_column_count(self->statement->st);
                 Py_END_ALLOW_THREADS
 
-                Py_XSETREF(self->description, PyTuple_New(numcols));
+                Py_SETREF(self->description, PyTuple_New(numcols));
                 if (!self->description) {
                     goto error;
                 }
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 6b58560..150229d 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -756,7 +756,7 @@
     if (!copy)
         return 0;
 
-    Py_XSETREF(*object, copy);
+    Py_SETREF(*object, copy);
 
     return 1; /* success */
 }
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8b5b8f7..d2b6500 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1589,7 +1589,7 @@
         return -1;
 #else
         Py_INCREF(value);
-        Py_XSETREF(self->ctx, (PySSLContext *)value);
+        Py_SETREF(self->ctx, (PySSLContext *)value);
         SSL_set_SSL_CTX(self->ssl, self->ctx->ctx);
 #endif
     } else {
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index a7f1111..781fbcd 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -631,7 +631,7 @@
         link = teedataobject_jumplink(to->dataobj);
         if (link == NULL)
             return NULL;
-        Py_XSETREF(to->dataobj, (teedataobject *)link);
+        Py_SETREF(to->dataobj, (teedataobject *)link);
         to->index = 0;
     }
     value = teedataobject_getitem(to->dataobj, to->index);
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 3edf158..da454de 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1266,7 +1266,7 @@
     if (Handlers[SIGINT].func == DefaultHandler) {
         /* Install default int handler */
         Py_INCREF(IntHandler);
-        Py_XSETREF(Handlers[SIGINT].func, IntHandler);
+        Py_SETREF(Handlers[SIGINT].func, IntHandler);
         old_siginthandler = PyOS_setsig(SIGINT, signal_handler);
     }
 
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 3abb9f0..e840271 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -155,7 +155,7 @@
             tmp = PyUnicode_FromFormat("%U%c", self->prefix, SEP);
             if (tmp == NULL)
                 goto error;
-            Py_XSETREF(self->prefix, tmp);
+            Py_SETREF(self->prefix, tmp);
         }
     }
     else
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 802e7db..eb62728 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -668,7 +668,7 @@
                       PyBytes_AS_STRING(self->unused_data), old_size);
             Py_MEMCPY(PyBytes_AS_STRING(new_data) + old_size,
                       self->zst.next_in, self->zst.avail_in);
-            Py_XSETREF(self->unused_data, new_data);
+            Py_SETREF(self->unused_data, new_data);
             self->zst.avail_in = 0;
         }
     }
@@ -680,7 +680,7 @@
                 (char *)self->zst.next_in, self->zst.avail_in);
         if (new_data == NULL)
             return -1;
-        Py_XSETREF(self->unconsumed_tail, new_data);
+        Py_SETREF(self->unconsumed_tail, new_data);
     }
     return 0;
 }