refactored sharedarea read

This commit is contained in:
Unbit
2013-11-30 18:30:52 +00:00
parent 92b6c62cac
commit b934ac9588
6 changed files with 23 additions and 9 deletions
+5 -2
View File
@@ -1600,14 +1600,17 @@ PyObject *py_uwsgi_sharedarea_read(PyObject * self, PyObject * args) {
#endif
UWSGI_RELEASE_GIL
int r = uwsgi_sharedarea_read(id, pos, storage, len);
int64_t rlen = uwsgi_sharedarea_read(id, pos, storage, len);
UWSGI_GET_GIL
if (r) {
if (rlen < 0) {
Py_DECREF(ret);
return PyErr_Format(PyExc_ValueError, "error calling uwsgi_sharedarea_read()");
}
// HACK: we are safe as rlen can only be lower or equal to len
Py_SIZE(ret) = rlen;
return ret;
}