mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-04 20:51:29 +00:00
refactored sharedarea read
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
#define PYTHREE
|
||||
#endif
|
||||
|
||||
#if (PY_VERSION_HEX < 0x02060000)
|
||||
#ifndef Py_SIZE
|
||||
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define UWSGI_GET_GIL up.gil_get();
|
||||
#define UWSGI_RELEASE_GIL up.gil_release();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user