[Python-checkins] python/dist/src/Python pythonrun.c,2.185,2.186

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 17 Apr 2003 08:21:09 -0700


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

Modified Files:
	pythonrun.c 
Log Message:
Py_Finalize():  Reverted recent changes that tried to move the
PYTHONDUMPREFS output after most teardown.  Attempts to use
PYTHONDUMPREFS with the Zope3 test suite died with Py_FatalError(),
since _Py_PrintReferences() can end up executing arbitrary Python code
(for objects that override __repr__), and that requires an intact
interpreter.


Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.185
retrieving revision 2.186
diff -C2 -d -r2.185 -r2.186
*** pythonrun.c	15 Apr 2003 15:10:54 -0000	2.185
--- pythonrun.c	17 Apr 2003 15:21:01 -0000	2.186
***************
*** 271,274 ****
--- 271,285 ----
  #endif
  
+ #ifdef Py_TRACE_REFS
+ 	/* Display all objects still alive -- this can invoke arbitrary
+ 	 * __repr__ overrides, so requires a mostly-intact interpreter.
+ 	 * Alas, a lot of stuff may still be alive now that will be cleaned
+ 	 * up later.
+ 	 */
+ 	if (Py_GETENV("PYTHONDUMPREFS")) {
+ 		_Py_PrintReferences(stderr);
+ 	}
+ #endif /* Py_TRACE_REFS */
+ 
  	/* Now we decref the exception classes.  After this point nothing
  	   can raise an exception.  That's okay, because each Fini() method
***************
*** 306,317 ****
  
  	PyGrammar_RemoveAccelerators(&_PyParser_Grammar);
- 
- #ifdef Py_TRACE_REFS
- 	/* Dump references -- this may implicitly need the thread state,
- 	   so this is the last possible place where we can do this. */
- 	if (Py_GETENV("PYTHONDUMPREFS")) {
- 		_Py_PrintReferences(stderr);
- 	}
- #endif /* Py_TRACE_REFS */
  
  #ifdef PYMALLOC_DEBUG
--- 317,320 ----