/* codecs.encode, used for saving bytes in older protocols */
PyObject *codecs_encode;
-
- /* As the name says, an empty tuple. */
- PyObject *empty_tuple;
} PickleState;
/* Forward declaration of the _pickle module definition. */
Py_CLEAR(st->name_mapping_3to2);
Py_CLEAR(st->import_mapping_3to2);
Py_CLEAR(st->codecs_encode);
- Py_CLEAR(st->empty_tuple);
}
/* Initialize the given pickle module state. */
}
Py_CLEAR(codecs);
- st->empty_tuple = PyTuple_New(0);
- if (st->empty_tuple == NULL)
- goto error;
-
return 0;
error:
return -1;
if (n == READ_WHOLE_LINE) {
- PickleState *st = _Pickle_GetGlobalState();
- data = PyObject_Call(self->readline, st->empty_tuple, NULL);
+ PyObject *empty_tuple = PyTuple_New(0);
+ data = PyObject_Call(self->readline, empty_tuple, NULL);
+ Py_DECREF(empty_tuple);
}
else {
PyObject *len = PyLong_FromSsize_t(n);
/* Check for a __reduce__ method. */
reduce_func = _PyObject_GetAttrId(obj, &PyId___reduce__);
if (reduce_func != NULL) {
- reduce_value = PyObject_Call(reduce_func, st->empty_tuple,
+ PyObject *empty_tuple = PyTuple_New(0);
+ reduce_value = PyObject_Call(reduce_func, empty_tuple,
NULL);
+ Py_DECREF(empty_tuple);
}
else {
PyErr_Format(st->PicklingError,
Py_VISIT(st->name_mapping_3to2);
Py_VISIT(st->import_mapping_3to2);
Py_VISIT(st->codecs_encode);
- Py_VISIT(st->empty_tuple);
return 0;
}