comparison Python/pythonrun.c @ 28647:9d4e138494fb legacy-trunk

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.
author Tim Peters <tim.peters@gmail.com>
date Thu, 17 Apr 2003 15:21:01 +0000
parents 4f0b7acffc7d
children 0e8416be208e
comparison
equal deleted inserted replaced
28646:193b8aec00ce 28647:9d4e138494fb
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 /* Display all objects still alive -- this can invoke arbitrary
275 * __repr__ overrides, so requires a mostly-intact interpreter.
276 * Alas, a lot of stuff may still be alive now that will be cleaned
277 * up later.
278 */
279 if (Py_GETENV("PYTHONDUMPREFS")) {
280 _Py_PrintReferences(stderr);
281 }
282 #endif /* Py_TRACE_REFS */
283
273 /* Now we decref the exception classes. After this point nothing 284 /* Now we decref the exception classes. After this point nothing
274 can raise an exception. That's okay, because each Fini() method 285 can raise an exception. That's okay, because each Fini() method
275 below has been checked to make sure no exceptions are ever 286 below has been checked to make sure no exceptions are ever
276 raised. 287 raised.
277 */ 288 */
303 - int and float free list blocks 314 - int and float free list blocks
304 - whatever various modules and libraries allocate 315 - whatever various modules and libraries allocate
305 */ 316 */
306 317
307 PyGrammar_RemoveAccelerators(&_PyParser_Grammar); 318 PyGrammar_RemoveAccelerators(&_PyParser_Grammar);
308
309 #ifdef Py_TRACE_REFS
310 /* Dump references -- this may implicitly need the thread state,
311 so this is the last possible place where we can do this. */
312 if (Py_GETENV("PYTHONDUMPREFS")) {
313 _Py_PrintReferences(stderr);
314 }
315 #endif /* Py_TRACE_REFS */
316 319
317 #ifdef PYMALLOC_DEBUG 320 #ifdef PYMALLOC_DEBUG
318 if (Py_GETENV("PYTHONMALLOCSTATS")) 321 if (Py_GETENV("PYTHONMALLOCSTATS"))
319 _PyObject_DebugMallocStats(); 322 _PyObject_DebugMallocStats();
320 #endif 323 #endif