comparison Python/pythonrun.c @ 17286:992460c668c1 2.0

- #119862 - getargs.c - patched memory leak - #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag until after the exit funcs have run
author Moshe Zadka <moshez@math.huji.ac.il>
date Sat, 31 Mar 2001 13:18:35 +0000
parents 37397bd1f8a8
children
comparison
equal deleted inserted replaced
17285:2b5768c13599 17286:992460c668c1
181 PyInterpreterState *interp; 181 PyInterpreterState *interp;
182 PyThreadState *tstate; 182 PyThreadState *tstate;
183 183
184 if (!initialized) 184 if (!initialized)
185 return; 185 return;
186
187 /* The interpreter is still entirely intact at this point, and the
188 * exit funcs may be relying on that. In particular, if some thread
189 * or exit func is still waiting to do an import, the import machinery
190 * expects Py_IsInitialized() to return true. So don't say the
191 * interpreter is uninitialized until after the exit funcs have run.
192 * Note that Threading.py uses an exit func to do a join on all the
193 * threads created thru it, so this also protects pending imports in
194 * the threads created via Threading.
195 */
196 call_sys_exitfunc();
186 initialized = 0; 197 initialized = 0;
187
188 call_sys_exitfunc();
189 198
190 /* Get current thread state and interpreter pointer */ 199 /* Get current thread state and interpreter pointer */
191 tstate = PyThreadState_Get(); 200 tstate = PyThreadState_Get();
192 interp = tstate->interp; 201 interp = tstate->interp;
193 202