summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoshe Zadka <moshez@math.huji.ac.il>2001-03-31 13:18:35 +0000
committerMoshe Zadka <moshez@math.huji.ac.il>2001-03-31 13:18:35 +0000
commitc2113eae86606938c3a024a0cf362ae098cf968c (patch)
tree4687f3ddfbb8c3a5d54df842a3a368e4ee772bc8
parent13945944e7ccffe525ea9cf97fab4988d67031b1 (diff)
downloadcpython-c2113eae86606938c3a024a0cf362ae098cf968c.tar.gz
- #119862 - getargs.c - patched memory leak
- #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag until after the exit funcs have run
-rw-r--r--Misc/NEWS5
-rw-r--r--Python/getargs.c1
-rw-r--r--Python/pythonrun.c11
3 files changed, 16 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 67430a2a5c..054923bc34 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -105,6 +105,11 @@ http://sourceforge.net/tracker/index.php?func=detail&aid=<id>&group_id=5470&atid
- #127718 - '@' were '`' seem to be confused.
+- #119862 - getargs.c - patched memory leak
+
+- #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag
+ until after the exit funcs have run
+
What's New in Python 2.0?
=========================
diff --git a/Python/getargs.c b/Python/getargs.c
index 46251ae75e..d2018cb6a5 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1124,6 +1124,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
return 0;
}
converted++;
+ Py_DECREF(item);
}
else {
PyErr_Clear();
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index e29e719d10..e0af0da030 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -183,9 +183,18 @@ Py_Finalize(void)
if (!initialized)
return;
- initialized = 0;
+ /* The interpreter is still entirely intact at this point, and the
+ * exit funcs may be relying on that. In particular, if some thread
+ * or exit func is still waiting to do an import, the import machinery
+ * expects Py_IsInitialized() to return true. So don't say the
+ * interpreter is uninitialized until after the exit funcs have run.
+ * Note that Threading.py uses an exit func to do a join on all the
+ * threads created thru it, so this also protects pending imports in
+ * the threads created via Threading.
+ */
call_sys_exitfunc();
+ initialized = 0;
/* Get current thread state and interpreter pointer */
tstate = PyThreadState_Get();