From 7ee90d1e1296d179422b9c196a8f73f8a5a890f7 Mon Sep 17 00:00:00 2001 From: "roberto@natty32" Date: Sat, 12 Mar 2011 14:52:11 +0100 Subject: [PATCH] fixed python uwsgi.cache_get --- plugins/python/uwsgi_pymodule.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 0ea78480..2e1e8398 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -2641,6 +2641,11 @@ PyObject *py_uwsgi_cache_get(PyObject * self, PyObject * args) { #endif uwsgi_rlock(uwsgi.cache_lock); value = uwsgi_cache_get(key, keylen, &valsize); + if (!value) { + uwsgi_rwunlock(uwsgi.cache_lock); + Py_INCREF(Py_None); + return Py_None; + } res = PyString_FromStringAndSize(value, valsize); #ifdef UWSGI_DEBUG gettimeofday(&tv2, NULL);