]>
Commit | Line | Data |
---|---|---|
7263950d BS |
1 | commit 5bb5d6d0113f6bbd72966a5c1f3e6d40c2e9c8fd |
2 | Author: Grisha Trubetskoy <grisha@modpython.org> | |
3 | Date: Tue Dec 1 22:07:50 2015 -0500 | |
4 | ||
5 | Do not import site.py for the main interpreter. Fixes #46. | |
6 | ||
7 | diff --git a/src/mod_python.c b/src/mod_python.c | |
8 | index 8c33c04..7e0ef1e 100644 | |
9 | --- a/src/mod_python.c | |
10 | +++ b/src/mod_python.c | |
11 | @@ -775,8 +775,15 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, | |
12 | /* disable user site directories */ | |
13 | Py_NoUserSiteDirectory = 1; | |
14 | ||
15 | - /* initialze the interpreter */ | |
16 | + /* Initialze the main interpreter. We do not want site.py to | |
17 | + * be imported because as of Python 2.7.9 it would cause a | |
18 | + * circular dependency related to _locale which breaks | |
19 | + * graceful restart so we set Py_NoSiteFlag to 1 just for this | |
20 | + * one time. (https://github.com/grisha/mod_python/issues/46) | |
21 | + */ | |
22 | + Py_NoSiteFlag = 1; | |
23 | Py_Initialize(); | |
24 | + Py_NoSiteFlag = 0; | |
25 | ||
26 | #ifdef WITH_THREAD | |
27 | /* create and acquire the interpreter lock */ | |
28 | @@ -2649,7 +2656,7 @@ static void PythonChildInitHandler(apr_pool_t *p, server_rec *s) | |
29 | * problems as well. Thus disable cleanup of Python when | |
30 | * child processes are being shutdown. (MODPYTHON-109) | |
31 | * | |
32 | - apr_pool_cleanup_register(p, NULL, python_finalize, apr_pool_cleanup_null); | |
33 | + * apr_pool_cleanup_register(p, NULL, python_finalize, apr_pool_cleanup_null); | |
34 | */ | |
35 | ||
36 | /* |