[Python-checkins] python/dist/src/Python codecs.c,2.13,2.14

mhammond@users.sourceforge.net mhammond@users.sourceforge.net
Thu, 18 Jul 2002 16:06:19 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv22297

Modified Files:
	codecs.c 
Log Message:
Fix bug [ 549731 ] Unicode encoders appears to leak references.

Python 2.2.1 bugfix candidate.

Index: codecs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v
retrieving revision 2.13
retrieving revision 2.14
diff -C2 -d -r2.13 -r2.14
*** codecs.c	26 Sep 2000 05:46:01 -0000	2.13
--- codecs.c	18 Jul 2002 23:06:17 -0000	2.14
***************
*** 272,275 ****
--- 272,276 ----
  	goto onError;
      v = PyTuple_GET_ITEM(codecs,0);
+     Py_DECREF(codecs);
      Py_INCREF(v);
      return v;
***************
*** 288,291 ****
--- 289,293 ----
  	goto onError;
      v = PyTuple_GET_ITEM(codecs,1);
+     Py_DECREF(codecs);
      Py_INCREF(v);
      return v;
***************
*** 299,308 ****
  			       const char *errors)
  {
!     PyObject *codecs;
  
      codecs = _PyCodec_Lookup(encoding);
      if (codecs == NULL)
  	goto onError;
!     return build_stream_codec(PyTuple_GET_ITEM(codecs,2),stream,errors);
  
   onError:
--- 301,312 ----
  			       const char *errors)
  {
!     PyObject *codecs, *ret;
  
      codecs = _PyCodec_Lookup(encoding);
      if (codecs == NULL)
  	goto onError;
!     ret = build_stream_codec(PyTuple_GET_ITEM(codecs,2),stream,errors);
!     Py_DECREF(codecs);
!     return ret;
  
   onError:
***************
*** 314,323 ****
  			       const char *errors)
  {
!     PyObject *codecs;
  
      codecs = _PyCodec_Lookup(encoding);
      if (codecs == NULL)
  	goto onError;
!     return build_stream_codec(PyTuple_GET_ITEM(codecs,3),stream,errors);
  
   onError:
--- 318,329 ----
  			       const char *errors)
  {
!     PyObject *codecs, *ret;
  
      codecs = _PyCodec_Lookup(encoding);
      if (codecs == NULL)
  	goto onError;
!     ret = build_stream_codec(PyTuple_GET_ITEM(codecs,3),stream,errors);
!     Py_DECREF(codecs);
!     return ret;
  
   onError: