diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-01-27 11:39:04 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-01-27 11:39:04 (GMT) |
commit | 7a565f0b9bc81b1811e31292bd501417cfab28ee (patch) | |
tree | fd2725ba8ed120fc33108df44d0de4f2cb60e3eb | |
parent | ca87aefe83c05dbd85cc18246f361d19dc593acc (diff) | |
download | cpython-7a565f0b9bc81b1811e31292bd501417cfab28ee.zip cpython-7a565f0b9bc81b1811e31292bd501417cfab28ee.tar.gz cpython-7a565f0b9bc81b1811e31292bd501417cfab28ee.tar.bz2 |
Fix reference counting of iconvcodec_Type. Fixes #670715.
Remove GC code; the base type does not need GC.
-rw-r--r-- | Modules/_iconv_codec.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/_iconv_codec.c b/Modules/_iconv_codec.c index 8e84eec..ccf63be 100644 --- a/Modules/_iconv_codec.c +++ b/Modules/_iconv_codec.c @@ -533,8 +533,6 @@ errorexit: static void iconvcodec_dealloc(iconvcodecObject *self) { - _PyObject_GC_UNTRACK(self); - if (self->enchdl != (iconv_t)-1) iconv_close(self->enchdl); if (self->dechdl != (iconv_t)-1) @@ -542,7 +540,7 @@ iconvcodec_dealloc(iconvcodecObject *self) if (self->encoding != NULL) PyMem_Free(self->encoding); - PyObject_GC_Del(self); + self->ob_type->tp_free((PyObject *)self); } static PyObject * @@ -573,8 +571,7 @@ statichere PyTypeObject iconvcodec_Type = { PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_GC, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ iconvcodec_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ @@ -593,7 +590,7 @@ statichere PyTypeObject iconvcodec_Type = { 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ iconvcodec_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ + PyObject_Del, /* tp_free */ }; static struct PyMethodDef _iconv_codec_methods[] = { @@ -608,6 +605,7 @@ init_iconv_codec(void) m = Py_InitModule("_iconv_codec", _iconv_codec_methods); PyModule_AddStringConstant(m, "__version__", (char*)__version__); + Py_INCREF(&iconvcodec_Type); PyModule_AddObject(m, "iconvcodec", (PyObject *)(&iconvcodec_Type)); PyModule_AddStringConstant(m, "internal_encoding", UNICODE_ENCODING); |