[Python-checkins] python/dist/src/Python pythonrun.c,2.183,2.184

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 15 Apr 2003 07:10:15 -0700


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

Modified Files:
	pythonrun.c 
Log Message:
Move the call to _Py_PrintReferences() a bit further down.  This
prevents it from showing stuff (like codec state) that is cleared when
the interpreter state is cleared.


Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.183
retrieving revision 2.184
diff -C2 -d -r2.183 -r2.184
*** pythonrun.c	10 Apr 2003 21:53:14 -0000	2.183
--- pythonrun.c	15 Apr 2003 14:10:09 -0000	2.184
***************
*** 271,280 ****
  #endif
  
- #ifdef Py_TRACE_REFS
- 	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
--- 271,274 ----
***************
*** 284,292 ****
  	_PyExc_Fini();
  
! 	/* Delete current thread */
  	PyInterpreterState_Clear(interp);
  	PyThreadState_Swap(NULL);
  	PyInterpreterState_Delete(interp);
  
  	PyMethod_Fini();
  	PyFrame_Fini();
--- 278,297 ----
  	_PyExc_Fini();
  
! 	/* Clear interpreter state */
  	PyInterpreterState_Clear(interp);
+ 
+ #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 */
+ 
+ 	/* Delete current thread */
  	PyThreadState_Swap(NULL);
  	PyInterpreterState_Delete(interp);
  
+ 	/* Sundry finalizers */
  	PyMethod_Fini();
  	PyFrame_Fini();