Skip to content

Commit

Permalink
Merge pull request #2672 from xrmx/traceback
Browse files Browse the repository at this point in the history
Fix --catch-exceptions causing a segfault in Python 3.5.
  • Loading branch information
xrmx authored Sep 8, 2024
2 parents f31b4e7 + fe44f47 commit 8d3bcc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/python/pyutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ struct uwsgi_buffer *uwsgi_python_backtrace(struct wsgi_request *wsgi_req) {
ub = uwsgi_buffer_new(4096);
Py_ssize_t i;
// we have to build a uwsgi array with 5 items (4 are taken from the python tb)
for(i=0;i< PyList_Size(result);i++) {
PyObject *t = PyList_GetItem(result, i);
PyObject *tb_filename = PyTuple_GetItem(t, 0);
PyObject *tb_lineno = PyTuple_GetItem(t, 1);
PyObject *tb_function = PyTuple_GetItem(t, 2);
PyObject *tb_text = PyTuple_GetItem(t, 3);
for(i=0;i< PySequence_Size(result);i++) {
PyObject *t = PySequence_GetItem(result, i);
PyObject *tb_filename = PySequence_GetItem(t, 0);
PyObject *tb_lineno = PySequence_GetItem(t, 1);
PyObject *tb_function = PySequence_GetItem(t, 2);
PyObject *tb_text = PySequence_GetItem(t, 3);

int64_t line_no = PyInt_AsLong(tb_lineno);
#ifdef PYTHREE
Expand Down

0 comments on commit 8d3bcc2

Please sign in to comment.