summaryrefslogtreecommitdiffstats
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_pickle.c')
-rw-r--r--Modules/_pickle.c8
1 files changed, 3 insertions, 5 deletions
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 @@ PyMemoTable_Set(PyMemoTable *self, PyObject *key, Py_ssize_t value)
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 @@ fix_imports(PyObject **module_name, PyObject **global_name)
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;