mirror of https://git.kore.io/kore.git
Python: allocate py_req in the http_request_free hook if needed.
Makes it possible to mix on_free with other runtimes.
This commit is contained in:
parent
e545657023
commit
a3800fa57e
|
@ -1331,8 +1331,10 @@ python_runtime_http_request_free(void *addr, struct http_request *req)
|
||||||
{
|
{
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
|
||||||
if (req->py_req == NULL)
|
if (req->py_req == NULL) {
|
||||||
fatal("%s: py_req is NULL", __func__);
|
if ((req->py_req = pyhttp_request_alloc(req)) == NULL)
|
||||||
|
fatal("%s: pyreq alloc failed", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
ret = PyObject_CallFunctionObjArgs(addr, req->py_req, NULL);
|
ret = PyObject_CallFunctionObjArgs(addr, req->py_req, NULL);
|
||||||
|
|
Loading…
Reference in New Issue