mirror of
https://github.com/python/cpython.git
synced 2025-12-10 19:10:59 +00:00
Add missing PyObject_GC_Track and PyObject_GC_UnTrack calls to csv reader and
writer objects (other GC infrastructure already in place).
This commit is contained in:
parent
36a7691c2d
commit
77ead87f30
1 changed files with 4 additions and 0 deletions
|
|
@ -776,6 +776,7 @@ Reader_iternext(ReaderObj *self)
|
||||||
static void
|
static void
|
||||||
Reader_dealloc(ReaderObj *self)
|
Reader_dealloc(ReaderObj *self)
|
||||||
{
|
{
|
||||||
|
PyObject_GC_UnTrack(self);
|
||||||
Py_XDECREF(self->dialect);
|
Py_XDECREF(self->dialect);
|
||||||
Py_XDECREF(self->input_iter);
|
Py_XDECREF(self->input_iter);
|
||||||
Py_XDECREF(self->fields);
|
Py_XDECREF(self->fields);
|
||||||
|
|
@ -909,6 +910,7 @@ csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject_GC_Track(self);
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1234,6 +1236,7 @@ static struct PyMemberDef Writer_memberlist[] = {
|
||||||
static void
|
static void
|
||||||
Writer_dealloc(WriterObj *self)
|
Writer_dealloc(WriterObj *self)
|
||||||
{
|
{
|
||||||
|
PyObject_GC_UnTrack(self);
|
||||||
Py_XDECREF(self->dialect);
|
Py_XDECREF(self->dialect);
|
||||||
Py_XDECREF(self->writeline);
|
Py_XDECREF(self->writeline);
|
||||||
if (self->rec != NULL)
|
if (self->rec != NULL)
|
||||||
|
|
@ -1349,6 +1352,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
PyObject_GC_Track(self);
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue