Issue #20440: Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 02dd7d3..196a093 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1377,15 +1377,13 @@
if (PyString_Check(o_format)) {
Py_INCREF(o_format);
- Py_CLEAR(soself->s_format);
- soself->s_format = o_format;
+ Py_SETREF(soself->s_format, o_format);
}
else if (PyUnicode_Check(o_format)) {
PyObject *str = PyUnicode_AsEncodedString(o_format, "ascii", NULL);
if (str == NULL)
return -1;
- Py_CLEAR(soself->s_format);
- soself->s_format = str;
+ Py_SETREF(soself->s_format, str);
}
else {
PyErr_Format(PyExc_TypeError,