kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit a3800fa57e9cfb98809ae0d53a5af7f0b27e343f
parent e545657023f7640fb3307ddb90b16235ed28f5e8
Author: Joris Vink <joris@coders.se>
Date:   Wed, 15 Dec 2021 12:19:04 +0100

Python: allocate py_req in the http_request_free hook if needed.

Makes it possible to mix on_free with other runtimes.

Diffstat:
src/python.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/python.c b/src/python.c @@ -1331,8 +1331,10 @@ python_runtime_http_request_free(void *addr, struct http_request *req) { PyObject *ret; - if (req->py_req == NULL) - fatal("%s: py_req is NULL", __func__); + if (req->py_req == NULL) { + if ((req->py_req = pyhttp_request_alloc(req)) == NULL) + fatal("%s: pyreq alloc failed", __func__); + } PyErr_Clear(); ret = PyObject_CallFunctionObjArgs(addr, req->py_req, NULL);