]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- #119862 - getargs.c - patched memory leak
authorMoshe Zadka <moshez@math.huji.ac.il>
Sat, 31 Mar 2001 13:18:35 +0000 (13:18 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Sat, 31 Mar 2001 13:18:35 +0000 (13:18 +0000)
- #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag
            until after the exit funcs have run

Misc/NEWS
Python/getargs.c
Python/pythonrun.c

index 67430a2a5cfb39ea892c6db035746b2877834cea..054923bc3426e0f86e3da58ab319c6f46f51a100 100644 (file)
--- 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?
 =========================
 
index 46251ae75e3bbde699122b8111f40c66915cd51c..d2018cb6a57075389f379430ae8f1e76ced0dff4 100644 (file)
@@ -1124,6 +1124,7 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
                                return 0;
                        }
                        converted++;
+                       Py_DECREF(item);
                }
                else {
                        PyErr_Clear();
index e29e719d10946630fae582b493c5d2f8cb47573b..e0af0da030fdf2aeea6c6caa28e7b69b46a41e1b 100644 (file)
@@ -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();