Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 14c5177..f585ffc 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3865,8 +3865,7 @@
return;
}
v = string_concat((PyStringObject *) *pv, w);
- Py_DECREF(*pv);
- *pv = v;
+ Py_SETREF(*pv, v);
}
void
@@ -4751,8 +4750,7 @@
t = PyDict_GetItem(interned, (PyObject *)s);
if (t) {
Py_INCREF(t);
- Py_DECREF(*p);
- *p = t;
+ Py_SETREF(*p, t);
return;
}