[Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.115,2.115.2.1 getargs.c,2.49,2.49.2.1

Moshe Zadka moshez@users.sourceforge.net
Sat, 31 Mar 2001 05:18:38 -0800


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

Modified Files:
      Tag: release20-maint
	pythonrun.c getargs.c 
Log Message:
- #119862 - getargs.c - patched memory leak

- #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag
            until after the exit funcs have run


Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.115
retrieving revision 2.115.2.1
diff -C2 -r2.115 -r2.115.2.1
*** pythonrun.c	2000/09/16 16:32:19	2.115
--- pythonrun.c	2001/03/31 13:18:35	2.115.2.1
***************
*** 184,190 ****
  	if (!initialized)
  		return;
- 	initialized = 0;
  
  	call_sys_exitfunc();
  
  	/* Get current thread state and interpreter pointer */
--- 184,199 ----
  	if (!initialized)
  		return;
  
+ 	/* The interpreter is still entirely intact at this point, and the
+ 	 * exit funcs may be relying on that.  In particular, if some thread
+ 	 * or exit func is still waiting to do an import, the import machinery
+ 	 * expects Py_IsInitialized() to return true.  So don't say the
+ 	 * interpreter is uninitialized until after the exit funcs have run.
+ 	 * Note that Threading.py uses an exit func to do a join on all the
+ 	 * threads created thru it, so this also protects pending imports in
+ 	 * the threads created via Threading.
+ 	 */
  	call_sys_exitfunc();
+ 	initialized = 0;
  
  	/* Get current thread state and interpreter pointer */

Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.49
retrieving revision 2.49.2.1
diff -C2 -r2.49 -r2.49.2.1
*** getargs.c	2000/09/26 05:46:01	2.49
--- getargs.c	2001/03/31 13:18:35	2.49.2.1
***************
*** 1125,1128 ****
--- 1125,1129 ----
  			}
  			converted++;
+ 			Py_DECREF(item);
  		}
  		else {