mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
[3.13] gh-130179: Fix persistent_{id,load}_attr reference leaks in _pickle (GH-130180) (#130190)
gh-130179: Fix `persistent_{id,load}_attr` reference leaks in `_pickle` (GH-130180)
(cherry picked from commit e7f00cd14f)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
ff92f6b228
commit
2fcad2a47b
1 changed files with 4 additions and 0 deletions
|
|
@ -4652,6 +4652,7 @@ Pickler_clear(PicklerObject *self)
|
|||
Py_CLEAR(self->output_buffer);
|
||||
Py_CLEAR(self->write);
|
||||
Py_CLEAR(self->persistent_id);
|
||||
Py_CLEAR(self->persistent_id_attr);
|
||||
Py_CLEAR(self->dispatch_table);
|
||||
Py_CLEAR(self->fast_memo);
|
||||
Py_CLEAR(self->reducer_override);
|
||||
|
|
@ -4681,6 +4682,7 @@ Pickler_traverse(PicklerObject *self, visitproc visit, void *arg)
|
|||
Py_VISIT(Py_TYPE(self));
|
||||
Py_VISIT(self->write);
|
||||
Py_VISIT(self->persistent_id);
|
||||
Py_VISIT(self->persistent_id_attr);
|
||||
Py_VISIT(self->dispatch_table);
|
||||
Py_VISIT(self->fast_memo);
|
||||
Py_VISIT(self->reducer_override);
|
||||
|
|
@ -7138,6 +7140,7 @@ Unpickler_clear(UnpicklerObject *self)
|
|||
Py_CLEAR(self->peek);
|
||||
Py_CLEAR(self->stack);
|
||||
Py_CLEAR(self->persistent_load);
|
||||
Py_CLEAR(self->persistent_load_attr);
|
||||
Py_CLEAR(self->buffers);
|
||||
if (self->buffer.buf != NULL) {
|
||||
PyBuffer_Release(&self->buffer);
|
||||
|
|
@ -7177,6 +7180,7 @@ Unpickler_traverse(UnpicklerObject *self, visitproc visit, void *arg)
|
|||
Py_VISIT(self->peek);
|
||||
Py_VISIT(self->stack);
|
||||
Py_VISIT(self->persistent_load);
|
||||
Py_VISIT(self->persistent_load_attr);
|
||||
Py_VISIT(self->buffers);
|
||||
PyObject **memo = self->memo;
|
||||
if (memo) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue