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/_pickle.c b/Modules/_pickle.c
index 56bbd58..2a070e2 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -846,9 +846,8 @@
static int
_Pickler_ClearBuffer(PicklerObject *self)
{
- Py_CLEAR(self->output_buffer);
- self->output_buffer =
- PyBytes_FromStringAndSize(NULL, self->max_output_len);
+ Py_SETREF(self->output_buffer,
+ PyBytes_FromStringAndSize(NULL, self->max_output_len));
if (self->output_buffer == NULL)
return -1;
self->output_len = 0;
@@ -3089,9 +3088,8 @@
Py_TYPE(item)->tp_name);
return -1;
}
- Py_CLEAR(*module_name);
Py_INCREF(item);
- *module_name = item;
+ Py_SETREF(*module_name, item);
}
else if (PyErr_Occurred()) {
return -1;