[Python-checkins] CVS: python/dist/src/Python exceptions.c,1.5,1.6

Barry Warsaw python-dev@python.org
Sun, 9 Jul 2000 15:27:13 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv22242

Modified Files:
	exceptions.c 
Log Message:
Exception__str__(): In case 1, be sure to decref the tmp local
variable.  This crushes another memory leak.  Slight rewrite
included.


Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** exceptions.c	2000/07/09 04:56:25	1.5
--- exceptions.c	2000/07/09 22:27:10	1.6
***************
*** 232,236 ****
  {
      PyObject* out;
-     PyObject* tmp;
  
      if (!PyArg_ParseTuple(args, "O", &self))
--- 232,235 ----
***************
*** 246,254 ****
          break;
      case 1:
! 	if (!(tmp = PySequence_GetItem(args, 0)))
! 	    out = NULL;
! 	else
  	    out = PyObject_Str(tmp);
  	break;
      default:
          out = PyObject_Str(args);
--- 245,258 ----
          break;
      case 1:
!     {
! 	PyObject* tmp = PySequence_GetItem(args, 0);
! 	if (tmp) {
  	    out = PyObject_Str(tmp);
+ 	    Py_DECREF(tmp);
+ 	}
+ 	else
+ 	    out = NULL;
  	break;
+     }
      default:
          out = PyObject_Str(args);