summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraham Dumpleton <Graham.Dumpleton@gmail.com>2022-05-02 10:44:04 +1000
committerGraham Dumpleton <Graham.Dumpleton@gmail.com>2022-05-02 10:44:04 +1000
commit2a3701e49a1fcc08946e9cb2fcd5c7f8ae6e2b85 (patch)
tree39bfc08e3356608b7b11425cca5f496823cbd70a /src
parent56bde85a5958ae60708142f706261da9dc54e296 (diff)
downloadmod_wsgi-2a3701e49a1fcc08946e9cb2fcd5c7f8ae6e2b85.tar.gz
Updates so compiles on Python 3.11.
Diffstat (limited to 'src')
-rw-r--r--src/server/mod_wsgi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c
index f537d44..00ae607 100644
--- a/src/server/mod_wsgi.c
+++ b/src/server/mod_wsgi.c
@@ -9548,6 +9548,9 @@ static void wsgi_log_stack_traces(void)
const char *filename = NULL;
const char *name = NULL;
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9)
+ lineno = PyFrame_GetLineNumber(current);
+#else
if (current->f_trace) {
lineno = current->f_lineno;
}
@@ -9555,10 +9558,16 @@ static void wsgi_log_stack_traces(void)
lineno = PyCode_Addr2Line(current->f_code,
current->f_lasti);
}
+#endif
#if PY_MAJOR_VERSION >= 3
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9)
+ filename = PyUnicode_AsUTF8(PyFrame_GetCode(current)->co_filename);
+ name = PyUnicode_AsUTF8(PyFrame_GetCode(current)->co_name);
+#else
filename = PyUnicode_AsUTF8(current->f_code->co_filename);
name = PyUnicode_AsUTF8(current->f_code->co_name);
+#endif
#else
filename = PyString_AsString(current->f_code->co_filename);
name = PyString_AsString(current->f_code->co_name);
@@ -9571,7 +9580,11 @@ static void wsgi_log_stack_traces(void)
getpid(), thread_id, filename, lineno, name);
}
else {
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9)
+ if (PyFrame_GetBack(current)) {
+#else
if (current->f_back) {
+#endif
ap_log_error(APLOG_MARK, APLOG_INFO, 0, wsgi_server,
"mod_wsgi (pid=%d): called from file "
"\"%s\", line %d, in %s,", getpid(),
@@ -9585,7 +9598,11 @@ static void wsgi_log_stack_traces(void)
}
}
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9)
+ current = PyFrame_GetBack(current);
+#else
current = current->f_back;
+#endif
}
}
}