comparison Python/pythonrun.c @ 28613:b1671550c7e1 legacy-trunk

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.
author Guido van Rossum <guido@python.org>
date Tue, 15 Apr 2003 14:10:09 +0000
parents be2ecafb15ad
children 4f0b7acffc7d
comparison
equal deleted inserted replaced
28612:0792caa6371c 28613:b1671550c7e1
268 268
269 #ifdef Py_REF_DEBUG 269 #ifdef Py_REF_DEBUG
270 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); 270 fprintf(stderr, "[%ld refs]\n", _Py_RefTotal);
271 #endif 271 #endif
272 272
273 #ifdef Py_TRACE_REFS
274 if (Py_GETENV("PYTHONDUMPREFS")) {
275 _Py_PrintReferences(stderr);
276 }
277 #endif /* Py_TRACE_REFS */
278
279 /* Now we decref the exception classes. After this point nothing 273 /* Now we decref the exception classes. After this point nothing
280 can raise an exception. That's okay, because each Fini() method 274 can raise an exception. That's okay, because each Fini() method
281 below has been checked to make sure no exceptions are ever 275 below has been checked to make sure no exceptions are ever
282 raised. 276 raised.
283 */ 277 */
284 _PyExc_Fini(); 278 _PyExc_Fini();
285 279
280 /* Clear interpreter state */
281 PyInterpreterState_Clear(interp);
282
283 #ifdef Py_TRACE_REFS
284 /* Dump references -- this may implicitly need the thread state,
285 so this is the last possible place where we can do this. */
286 if (Py_GETENV("PYTHONDUMPREFS")) {
287 _Py_PrintReferences(stderr);
288 }
289 #endif /* Py_TRACE_REFS */
290
286 /* Delete current thread */ 291 /* Delete current thread */
287 PyInterpreterState_Clear(interp);
288 PyThreadState_Swap(NULL); 292 PyThreadState_Swap(NULL);
289 PyInterpreterState_Delete(interp); 293 PyInterpreterState_Delete(interp);
290 294
295 /* Sundry finalizers */
291 PyMethod_Fini(); 296 PyMethod_Fini();
292 PyFrame_Fini(); 297 PyFrame_Fini();
293 PyCFunction_Fini(); 298 PyCFunction_Fini();
294 PyTuple_Fini(); 299 PyTuple_Fini();
295 PyString_Fini(); 300 PyString_Fini();