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

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


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

Modified Files:
	pythonrun.c 
Log Message:
- pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()
  even farther down, to just before the call to
  _PyObject_DebugMallocStats().  This required the following changes:

- pystate.c, PyThreadState_GetDict(): changed not to raise an
  exception or issue a fatal error when no current thread state is
  available, but simply return NULL without raising an exception
  (ever).

- object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL,
  don't raise an exception but return 0.  This means that when
  printing a container that's recursive, printing will go on and on
  and on.  But that shouldn't happen in the case we care about (see
  first bullet).

- Updated Misc/NEWS and Doc/api/init.tex to reflect changes to
  PyThreadState_GetDict() definition.



Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.184
retrieving revision 2.185
diff -C2 -d -r2.184 -r2.185
*** pythonrun.c	15 Apr 2003 14:10:09 -0000	2.184
--- pythonrun.c	15 Apr 2003 15:10:54 -0000	2.185
***************
*** 281,292 ****
  	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);
--- 281,284 ----
***************
*** 314,317 ****
--- 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