[Python-checkins] python/dist/src/Python compile.c,2.291,2.291.6.1

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Sep 16 00:36:35 EDT 2003


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

Modified Files:
      Tag: release23-maint
	compile.c 
Log Message:
Backport leak fix for new code objects.

Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.291
retrieving revision 2.291.6.1
diff -C2 -d -r2.291 -r2.291.6.1
*** compile.c	15 Jul 2003 20:23:26 -0000	2.291
--- compile.c	16 Sep 2003 04:36:33 -0000	2.291.6.1
***************
*** 105,108 ****
--- 105,110 ----
  	int stacksize;
  	int flags;
+ 	PyObject *co;
+ 	PyObject *empty = NULL;
  	PyObject *code;
  	PyObject *consts;
***************
*** 128,146 ****
  		return NULL;
  
- 	if (freevars == NULL || cellvars == NULL) {
- 		PyObject *empty = PyTuple_New(0);
- 		if (empty == NULL)
- 		    return NULL;
- 		if (freevars == NULL) {
- 		    freevars = empty;
- 		    Py_INCREF(freevars);
- 		}
- 		if (cellvars == NULL) {
- 		    cellvars = empty;
- 		    Py_INCREF(cellvars);
- 		}
- 		Py_DECREF(empty);
- 	}
- 
  	if (!PyObject_CheckReadBuffer(code)) {
  		PyErr_SetString(PyExc_TypeError,
--- 130,133 ----
***************
*** 149,156 ****
  	}
  
! 	return (PyObject *)PyCode_New(argcount, nlocals, stacksize, flags,
  				      code, consts, names, varnames,
  				      freevars, cellvars, filename, name,
! 				      firstlineno, lnotab); 
  }
  
--- 136,155 ----
  	}
  
! 	if (freevars == NULL || cellvars == NULL) {
! 		empty = PyTuple_New(0);
! 		if (empty == NULL)
! 			return NULL;
! 		if (freevars == NULL)
! 			freevars = empty;
! 		if (cellvars == NULL)
! 			cellvars = empty;
! 	}
! 
! 	co = (PyObject *) PyCode_New(argcount, nlocals, stacksize, flags,
  				      code, consts, names, varnames,
  				      freevars, cellvars, filename, name,
! 				      firstlineno, lnotab);
! 	Py_XDECREF(empty);
! 	return co;
  }
  





More information about the Python-checkins mailing list