From 4e21fe66074e2f5ba9da36582a2c9d0122fa6b80 Mon Sep 17 00:00:00 2001 From: "roberto@oneiric64" Date: Wed, 18 Jan 2012 05:01:22 +0100 Subject: [PATCH] fix uwsgi.atexit when threading mode is enabled --- plugins/python/python_plugin.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 5befe79b..ca9d4cef 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -197,6 +197,9 @@ void uwsgi_python_reset_random_seed() { void uwsgi_python_atexit() { + // this time we use this higher level function + // as this code can be executed in a signal handler + PyGILState_Ensure(); // no need to worry about freeing memory PyObject *uwsgi_dict = get_uwsgi_pydict("uwsgi"); if (uwsgi_dict) {