mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-05 13:11:33 +00:00
correctly support python2.4
This commit is contained in:
@@ -291,8 +291,9 @@ request:
|
||||
}
|
||||
|
||||
end:
|
||||
if (greenlet_switch)
|
||||
if (greenlet_switch) {
|
||||
Py_DECREF(greenlet_switch);
|
||||
}
|
||||
end2:
|
||||
Py_DECREF(current_greenlet);
|
||||
|
||||
|
||||
@@ -18,13 +18,15 @@ extern PyTypeObject uwsgi_InputType;
|
||||
*/
|
||||
|
||||
int uwsgi_python_send_body(struct wsgi_request *wsgi_req, PyObject *chunk) {
|
||||
char *content = NULL;
|
||||
size_t content_len = 0;
|
||||
|
||||
if (!up.wsgi_accept_buffer && !wsgi_req->is_raw) goto strict;
|
||||
#if defined(PYTHREE) || defined(Py_TPFLAGS_HAVE_NEWBUFFER)
|
||||
Py_buffer pbuf;
|
||||
int has_buffer = 0;
|
||||
#endif
|
||||
char *content = NULL;
|
||||
size_t content_len = 0;
|
||||
|
||||
#if defined(PYTHREE) || defined(Py_TPFLAGS_HAVE_NEWBUFFER)
|
||||
if (PyObject_CheckBuffer(chunk)) {
|
||||
if (!PyObject_GetBuffer(chunk, &pbuf, PyBUF_SIMPLE)) {
|
||||
@@ -36,10 +38,18 @@ int uwsgi_python_send_body(struct wsgi_request *wsgi_req, PyObject *chunk) {
|
||||
}
|
||||
#else
|
||||
if (PyObject_CheckReadBuffer(chunk)) {
|
||||
#ifdef UWSGI_PYTHON_OLD
|
||||
int buffer_len = 0;
|
||||
if (!PyObject_AsCharBuffer(chunk, (const char **) &content, &buffer_len)) {
|
||||
#else
|
||||
if (!PyObject_AsCharBuffer(chunk, (const char **) &content, (Py_ssize_t *) &content_len)) {
|
||||
#endif
|
||||
PyErr_Clear();
|
||||
goto found;
|
||||
}
|
||||
#ifdef UWSGI_PYTHON_OLD
|
||||
content_len = buffer_len;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user