@@ -533,16 +533,14 @@ iconvcodec_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
533533static void
534534iconvcodec_dealloc (iconvcodecObject * self )
535535{
536- _PyObject_GC_UNTRACK (self );
537-
538536 if (self -> enchdl != (iconv_t )- 1 )
539537 iconv_close (self -> enchdl );
540538 if (self -> dechdl != (iconv_t )- 1 )
541539 iconv_close (self -> dechdl );
542540 if (self -> encoding != NULL )
543541 PyMem_Free (self -> encoding );
544542
545- PyObject_GC_Del ( self );
543+ self -> ob_type -> tp_free (( PyObject * ) self );
546544}
547545
548546static PyObject *
@@ -573,8 +571,7 @@ statichere PyTypeObject iconvcodec_Type = {
573571 PyObject_GenericGetAttr , /* tp_getattro */
574572 0 , /* tp_setattro */
575573 0 , /* tp_as_buffer */
576- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
577- Py_TPFLAGS_HAVE_GC , /* tp_flags */
574+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE , /* tp_flags */
578575 iconvcodec_doc , /* tp_doc */
579576 0 , /* tp_traverse */
580577 0 , /* tp_clear */
@@ -593,7 +590,7 @@ statichere PyTypeObject iconvcodec_Type = {
593590 0 , /* tp_init */
594591 PyType_GenericAlloc , /* tp_alloc */
595592 iconvcodec_new , /* tp_new */
596- PyObject_GC_Del , /* tp_free */
593+ PyObject_Del , /* tp_free */
597594};
598595
599596static struct PyMethodDef _iconv_codec_methods [] = {
@@ -608,6 +605,7 @@ init_iconv_codec(void)
608605 m = Py_InitModule ("_iconv_codec" , _iconv_codec_methods );
609606
610607 PyModule_AddStringConstant (m , "__version__" , (char * )__version__ );
608+ Py_INCREF (& iconvcodec_Type );
611609 PyModule_AddObject (m , "iconvcodec" , (PyObject * )(& iconvcodec_Type ));
612610 PyModule_AddStringConstant (m , "internal_encoding" , UNICODE_ENCODING );
613611
0 commit comments