summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2014-06-19 21:45:09 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2014-06-19 21:45:09 (GMT)
commite4cda6ce21dc268e308f0ee95e097f667f680d43 (patch)
tree083b7fbe6e01e752a0c367729b513e9dcc5c9bfd /Python/pythonrun.c
parentcee4f034385902659ec1ade666e17537eb2bc399 (diff)
parent077c9564b7f0c09352d1d918f38d2cb75fe61881 (diff)
downloadcpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.zip
cpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.tar.gz
cpython-e4cda6ce21dc268e308f0ee95e097f667f680d43.tar.bz2
Merge.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 2a40c0b..748a63b 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -91,6 +91,8 @@ int _Py_QnewFlag = 0;
int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
+PyThreadState *_Py_Finalizing = NULL;
+
/* Hack to force loading of object files */
int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \
@@ -163,6 +165,7 @@ Py_InitializeEx(int install_sigs)
if (initialized)
return;
initialized = 1;
+ _Py_Finalizing = NULL;
if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0')
Py_DebugFlag = add_flag(Py_DebugFlag, p);
@@ -422,12 +425,16 @@ Py_Finalize(void)
* the threads created via Threading.
*/
call_sys_exitfunc();
- initialized = 0;
/* Get current thread state and interpreter pointer */
tstate = PyThreadState_GET();
interp = tstate->interp;
+ /* Remaining threads (e.g. daemon threads) will automatically exit
+ after taking the GIL (in PyEval_RestoreThread()). */
+ _Py_Finalizing = tstate;
+ initialized = 0;
+
/* Disable signal handling */
PyOS_FiniInterrupts();