summaryrefslogtreecommitdiff
path: root/Modules/_pickle.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-27 12:36:18 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-27 12:36:18 +0200
commit4a1e70fc31d224786a32f950edaf73c8ea9c194d (patch)
tree2000711f6cd68f009e4859ce3f9e1e9fe0a1f76e /Modules/_pickle.c
parenta5892abf235c67cf8e75b7fcef65e6aebe701d4c (diff)
downloadcpython-git-4a1e70fc31d224786a32f950edaf73c8ea9c194d.tar.gz
Issue #20440: Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
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 56bbd587b5..2a070e22e7 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;