Skip to content

Commit

Permalink
Do not import site.py for the main interpreter. Fixes #46.
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha committed Dec 2, 2015
1 parent e995e03 commit 5bb5d6d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/mod_python.c
Expand Up @@ -775,8 +775,15 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp,
/* disable user site directories */
Py_NoUserSiteDirectory = 1;

/* initialze the interpreter */
/* Initialze the main interpreter. We do not want site.py to
* be imported because as of Python 2.7.9 it would cause a
* circular dependency related to _locale which breaks
* graceful restart so we set Py_NoSiteFlag to 1 just for this
* one time. (https://github.com/grisha/mod_python/issues/46)
*/
Py_NoSiteFlag = 1;
Py_Initialize();
Py_NoSiteFlag = 0;

#ifdef WITH_THREAD
/* create and acquire the interpreter lock */
Expand Down Expand Up @@ -2649,7 +2656,7 @@ static void PythonChildInitHandler(apr_pool_t *p, server_rec *s)
* problems as well. Thus disable cleanup of Python when
* child processes are being shutdown. (MODPYTHON-109)
*
apr_pool_cleanup_register(p, NULL, python_finalize, apr_pool_cleanup_null);
* apr_pool_cleanup_register(p, NULL, python_finalize, apr_pool_cleanup_null);
*/

/*
Expand Down

0 comments on commit 5bb5d6d

Please sign in to comment.