Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
in places where Py_DECREF was used.
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 8906f1a..3fc0e13 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -59,7 +59,7 @@
return -1;
Py_INCREF(args);
- Py_XSETREF(self->args, args);
+ Py_SETREF(self->args, args);
if (PyTuple_GET_SIZE(self->args) == 1) {
Py_INCREF(PyTuple_GET_ITEM(self->args, 0));
@@ -622,7 +622,7 @@
if (!subslice)
return -1;
- Py_XSETREF(self->args, subslice);
+ Py_SETREF(self->args, subslice);
}
return 0;
}
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index e4f7fc4..9ae068c 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -574,8 +574,8 @@
oerrors = Py_None;
Py_INCREF(Py_None);
}
- Py_XSETREF(file->f_encoding, str);
- Py_XSETREF(file->f_errors, oerrors);
+ Py_SETREF(file->f_encoding, str);
+ Py_SETREF(file->f_errors, oerrors);
return 1;
}
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 2636962..0e76a44 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -428,7 +428,7 @@
if (name != Py_None) {
Py_INCREF(name);
- Py_XSETREF(newfunc->func_name, name);
+ Py_SETREF(newfunc->func_name, name);
}
if (defaults != Py_None) {
Py_INCREF(defaults);
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index faaa111..f585ffc 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3865,7 +3865,7 @@
return;
}
v = string_concat((PyStringObject *) *pv, w);
- Py_XSETREF(*pv, v);
+ Py_SETREF(*pv, v);
}
void
@@ -4750,7 +4750,7 @@
t = PyDict_GetItem(interned, (PyObject *)s);
if (t) {
Py_INCREF(t);
- Py_XSETREF(*p, t);
+ Py_SETREF(*p, t);
return;
}
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index d06ce2c..0b81a3c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -436,7 +436,7 @@
return -1;
Py_UNICODE_COPY(w->str, v->str,
length < v->length ? length : v->length);
- Py_XSETREF(*unicode, w);
+ Py_SETREF(*unicode, w);
return 0;
}