summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-15 15:12:39 +0000
committerGuido van Rossum <guido@python.org>2003-04-15 15:12:39 +0000
commit442365983beef2a9e8713bf1022201fec42cd42e (patch)
treee69fc332afc0bd43e437c2332e2c7ae0681158ea /Python/pythonrun.c
parentff921d0572cd70788442e36236776108e027dcba (diff)
downloadcpython-442365983beef2a9e8713bf1022201fec42cd42e.tar.gz
- 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.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index fdbd19f187..fbf4283ea9 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -280,14 +280,6 @@ Py_Finalize(void)
/* 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);
@@ -314,6 +306,14 @@ Py_Finalize(void)
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
if (Py_GETENV("PYTHONMALLOCSTATS"))
_PyObject_DebugMallocStats();