Skip to content

Commit 9908a94

Browse files
authored
untrack the refs (python#45)
1 parent fee6cd6 commit 9908a94

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Python/marshal.c

+4
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
17241724
rf.refs = PyList_New(0);
17251725
if (rf.refs == NULL)
17261726
return NULL;
1727+
PyObject_GC_UnTrack(rf.refs);
17271728
rf.refs_pos = 0;
17281729
rf.ctx = NULL;
17291730
result = read_object(&rf);
@@ -1747,6 +1748,7 @@ PyMarshal_ReadObjectFromString(const char *str, Py_ssize_t len)
17471748
rf.refs = PyList_New(0);
17481749
if (rf.refs == NULL)
17491750
return NULL;
1751+
PyObject_GC_UnTrack(rf.refs);
17501752
rf.refs_pos = 0;
17511753
rf.ctx = NULL;
17521754
result = read_object(&rf);
@@ -1881,6 +1883,7 @@ marshal_load(PyObject *module, PyObject *file)
18811883
rf.ptr = rf.end = NULL;
18821884
rf.buf = NULL;
18831885
if ((rf.refs = PyList_New(0)) != NULL) {
1886+
PyObject_GC_UnTrack(rf.refs);
18841887
rf.refs_pos = 0;
18851888
rf.ctx = NULL;
18861889
result = read_object(&rf);
@@ -1945,6 +1948,7 @@ marshal_loads_impl(PyObject *module, Py_buffer *bytes, int lazy)
19451948
rf.depth = 0;
19461949
if ((rf.refs = PyList_New(0)) == NULL)
19471950
return NULL;
1951+
PyObject_GC_UnTrack(rf.refs);
19481952
rf.refs_pos = 0;
19491953
rf.ctx = NULL;
19501954
if (lazy < 0)

0 commit comments

Comments
 (0)