From b59f3b254f86c90c78b0b3107e9b8f1f190cd49e Mon Sep 17 00:00:00 2001 From: Roberto De Ioris Date: Mon, 21 Jan 2013 14:50:27 +0100 Subject: [PATCH] fixed buf in python uwsgi.workers() --- plugins/python/uwsgi_pymodule.c | 6 ++++-- plugins/python/wsgi_headers.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index c2d9b8a1..8c6e8700 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -809,9 +809,12 @@ PyObject *py_uwsgi_offload_transfer(PyObject * self, PyObject * args) { } if (!wsgi_req->headers_sent) { + UWSGI_RELEASE_GIL if (uwsgi_response_write_headers_do(wsgi_req)) { + UWSGI_GET_GIL return PyErr_Format(PyExc_ValueError, "unable to send headers before offload transfer"); } + UWSGI_GET_GIL } @@ -2817,6 +2820,7 @@ PyObject *py_uwsgi_workers(PyObject * self, PyObject * args) { } Py_DECREF(zero); + zero = PyInt_FromLong(uwsgi.workers[i + 1].pid); if (PyDict_SetItemString(worker_dict, "pid", zero)) { goto clear; @@ -2960,12 +2964,10 @@ PyObject *py_uwsgi_workers(PyObject * self, PyObject * args) { Py_DECREF(zero); PyTuple_SetItem(apps_tuple, j, apps_dict); - } PyDict_SetItemString(worker_dict, "apps", apps_tuple); - Py_DECREF(apps_tuple); } diff --git a/plugins/python/wsgi_headers.c b/plugins/python/wsgi_headers.c index bcabdf5a..ef0bd414 100644 --- a/plugins/python/wsgi_headers.c +++ b/plugins/python/wsgi_headers.c @@ -162,9 +162,12 @@ PyObject *py_uwsgi_spit(PyObject * self, PyObject * args) { } if (up.start_response_nodelay) { + UWSGI_RELEASE_GIL if (uwsgi_response_write_headers_do(wsgi_req)) { + UWSGI_GET_GIL return PyErr_Format(PyExc_IOError, "unable to directly send headers"); } + UWSGI_GET_GIL } Py_INCREF(up.wsgi_writeout);