From e315c604fe7905cb9b25a58c2f72d613256678bd Mon Sep 17 00:00:00 2001 From: Unbit Date: Fri, 1 Aug 2014 12:41:55 +0200 Subject: [PATCH] allow calling the spooler from every cpython context --- plugins/python/uwsgi_pymodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 1947f8c8..089976a6 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -1855,7 +1855,6 @@ PyObject *py_uwsgi_send_spool(PyObject * self, PyObject * args, PyObject *kw) { PyObject *spool_dict, *spool_vars; PyObject *zero, *key, *val; uint16_t keysize, valsize; - struct wsgi_request *wsgi_req = py_current_wsgi_req(); char *body = NULL; size_t body_len= 0; @@ -1956,7 +1955,8 @@ PyObject *py_uwsgi_send_spool(PyObject * self, PyObject * args, PyObject *kw) { UWSGI_RELEASE_GIL - char *filename = uwsgi_spool_request(wsgi_req, ub->buf, ub->pos, body, body_len); + // current_wsgi_req can be NULL, in such a case a non-thread-safe counter will be used + char *filename = uwsgi_spool_request(current_wsgi_req(), ub->buf, ub->pos, body, body_len); uwsgi_buffer_destroy(ub); UWSGI_GET_GIL