[Python-checkins] python/dist/src/Modules _iconv_codec.c,1.3,1.4

loewis@users.sourceforge.net loewis@users.sourceforge.net
Mon, 27 Jan 2003 03:39:06 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv10728

Modified Files:
	_iconv_codec.c 
Log Message:
Fix reference counting of iconvcodec_Type. Fixes #670715.
Remove GC code; the base type does not need GC.


Index: _iconv_codec.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_iconv_codec.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** _iconv_codec.c	26 Jan 2003 16:26:20 -0000	1.3
--- _iconv_codec.c	27 Jan 2003 11:39:04 -0000	1.4
***************
*** 534,539 ****
  iconvcodec_dealloc(iconvcodecObject *self)
  {
-     _PyObject_GC_UNTRACK(self);
- 
      if (self->enchdl != (iconv_t)-1)
          iconv_close(self->enchdl);
--- 534,537 ----
***************
*** 543,547 ****
          PyMem_Free(self->encoding);
  
!     PyObject_GC_Del(self);
  }
  
--- 541,545 ----
          PyMem_Free(self->encoding);
  
!     self->ob_type->tp_free((PyObject *)self);
  }
  
***************
*** 574,579 ****
      0,                              /* tp_setattro */
      0,                              /* tp_as_buffer */
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
!              Py_TPFLAGS_HAVE_GC,    /* tp_flags */
      iconvcodec_doc,                 /* tp_doc */
      0,                              /* tp_traverse */
--- 572,576 ----
      0,                              /* tp_setattro */
      0,                              /* tp_as_buffer */
!     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,    /* tp_flags */
      iconvcodec_doc,                 /* tp_doc */
      0,                              /* tp_traverse */
***************
*** 594,598 ****
      PyType_GenericAlloc,            /* tp_alloc */
      iconvcodec_new,                 /* tp_new */
!     PyObject_GC_Del,                /* tp_free */
  };
  
--- 591,595 ----
      PyType_GenericAlloc,            /* tp_alloc */
      iconvcodec_new,                 /* tp_new */
!     PyObject_Del,                   /* tp_free */
  };
  
***************
*** 609,612 ****
--- 606,610 ----
  
      PyModule_AddStringConstant(m, "__version__", (char*)__version__);
+     Py_INCREF(&iconvcodec_Type);
      PyModule_AddObject(m, "iconvcodec", (PyObject *)(&iconvcodec_Type));
      PyModule_AddStringConstant(m, "internal_encoding", UNICODE_ENCODING);