Skip to content

Commit

Permalink
untrack the refs (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored Jul 22, 2021
1 parent fee6cd6 commit 9908a94
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Python/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
rf.refs = PyList_New(0);
if (rf.refs == NULL)
return NULL;
PyObject_GC_UnTrack(rf.refs);
rf.refs_pos = 0;
rf.ctx = NULL;
result = read_object(&rf);
Expand All @@ -1747,6 +1748,7 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
rf.refs = PyList_New(0);
if (rf.refs == NULL)
return NULL;
PyObject_GC_UnTrack(rf.refs);
rf.refs_pos = 0;
rf.ctx = NULL;
result = read_object(&rf);
Expand Down Expand Up @@ -1881,6 +1883,7 @@ marshal_load(PyObject *module, PyObject *file)
rf.ptr = rf.end = NULL;
rf.buf = NULL;
if ((rf.refs = PyList_New(0)) != NULL) {
PyObject_GC_UnTrack(rf.refs);
rf.refs_pos = 0;
rf.ctx = NULL;
result = read_object(&rf);
Expand Down Expand Up @@ -1945,6 +1948,7 @@ marshal_loads_impl(PyObject *module, Py_buffer *bytes, int lazy)
rf.depth = 0;
if ((rf.refs = PyList_New(0)) == NULL)
return NULL;
PyObject_GC_UnTrack(rf.refs);
rf.refs_pos = 0;
rf.ctx = NULL;
if (lazy < 0)
Expand Down

0 comments on commit 9908a94

Please sign in to comment.