PyObject_CallObject freezing

Joined
Aug 16, 2022
Messages
2
Reaction score
0
[First post]
Hi all,
this piece of C code is freezing at PyObject *result = PyObject_CallObject(...). I'd expect it to hang and get a segfault, but it's freezing! Can anyone help?
C:
PyObject *page_module = PyImport_ImportModule(strtok(basename(reqline[1]), "."));
PyObject *page_main_func = PyObject_GetAttrString(page_module, "http_main");
PyObject *page_url_params = PyList_New(0);
PyObject *param = NULL;
for (int i = 0; i != url_params_count; ++i) {
    param = Py_BuildValue("s", (const char*) url_params[i]);
    PyList_Append(page_url_params, param);
}
PyObject *result = PyObject_CallObject(page_main_func, Py_BuildValue("(O)", page_url_params));

PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
if (type != NULL) {
    PyErr_Restore(type, value, traceback);
    PyErr_Print();
    printf("\n");
    write(clients[n], resp_500_header, strlen(resp_500_header));
    write(clients[n], default_resp_500_page, strlen(default_resp_500_page));
}
It sounds like I'm making a C web server, right? That's because I am. ; )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top