diff options
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r-- | Modules/_io/textio.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index e858a1fb49..46411c70a9 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -167,12 +167,6 @@ textiobase_errors_get(PyObject *self, void *context) Py_RETURN_NONE; } -static int -textiobase_traverse(PyObject *self, visitproc visit, void *arg) -{ - Py_VISIT(Py_TYPE(self)); - return 0; -} static PyMethodDef textiobase_methods[] = { _IO__TEXTIOBASE_DETACH_METHODDEF @@ -193,13 +187,13 @@ static PyType_Slot textiobase_slots[] = { {Py_tp_doc, (void *)textiobase_doc}, {Py_tp_methods, textiobase_methods}, {Py_tp_getset, textiobase_getset}, - {Py_tp_traverse, textiobase_traverse}, {0, NULL}, }; +/* Do not set Py_TPFLAGS_HAVE_GC so that tp_traverse and tp_clear are inherited */ PyType_Spec textiobase_spec = { .name = "_io._TextIOBase", - .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | + .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_IMMUTABLETYPE), .slots = textiobase_slots, }; |