diff -urNp -x '*.orig' mod_python-3.5.0.org/src/mod_python.c mod_python-3.5.0/src/mod_python.c --- mod_python-3.5.0.org/src/mod_python.c 2013-11-12 04:21:34.000000000 +0100 +++ mod_python-3.5.0/src/mod_python.c 2021-03-02 22:05:35.833364242 +0100 @@ -772,8 +772,15 @@ static int python_init(apr_pool_t *p, ap { initialized = 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 */ @@ -2646,7 +2653,7 @@ static void PythonChildInitHandler(apr_p * 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); */ /*