comparison Python/pythonrun.c @ 34834:7cfda9898863 legacy-trunk

Move exception finalisation later in the shutdown process - this fixes the crash seen in bug #1165761
author Anthony Baxter <anthonybaxter@gmail.com>
date Tue, 29 Mar 2005 13:36:16 +0000
parents 3785610ff763
children 1dd8a0d64432
comparison
equal deleted inserted replaced
34829:b72df8aee56d 34834:7cfda9898863
390 */ 390 */
391 if (Py_GETENV("PYTHONDUMPREFS")) 391 if (Py_GETENV("PYTHONDUMPREFS"))
392 _Py_PrintReferences(stderr); 392 _Py_PrintReferences(stderr);
393 #endif /* Py_TRACE_REFS */ 393 #endif /* Py_TRACE_REFS */
394 394
395 /* Cleanup auto-thread-state */
396 #ifdef WITH_THREAD
397 _PyGILState_Fini();
398 #endif /* WITH_THREAD */
399
400 /* Clear interpreter state */
401 PyInterpreterState_Clear(interp);
402
395 /* Now we decref the exception classes. After this point nothing 403 /* Now we decref the exception classes. After this point nothing
396 can raise an exception. That's okay, because each Fini() method 404 can raise an exception. That's okay, because each Fini() method
397 below has been checked to make sure no exceptions are ever 405 below has been checked to make sure no exceptions are ever
398 raised. 406 raised.
399 */ 407 */
408
400 _PyExc_Fini(); 409 _PyExc_Fini();
401
402 /* Cleanup auto-thread-state */
403 #ifdef WITH_THREAD
404 _PyGILState_Fini();
405 #endif /* WITH_THREAD */
406
407 /* Clear interpreter state */
408 PyInterpreterState_Clear(interp);
409 410
410 /* Delete current thread */ 411 /* Delete current thread */
411 PyThreadState_Swap(NULL); 412 PyThreadState_Swap(NULL);
412 PyInterpreterState_Delete(interp); 413 PyInterpreterState_Delete(interp);
413 414