Please find attached a patch for the problem. With this patch applied, libapache2-mod-python works with python 3.9.
diff --git a/lib/python/mod_python/apache.py b/lib/python/mod_python/apache.py index 7748108..4e5c1d8 100644 --- a/lib/python/mod_python/apache.py +++ b/lib/python/mod_python/apache.py @@ -26,7 +26,7 @@ import pdb import stat import imp import types -import cgi +import html import _apache try: @@ -549,7 +549,7 @@ class CallBack: s = '\n<pre>\nMod_python error: "%s %s"\n\n' % (phase, hname) for e in traceback.format_exception(etype, evalue, etb): - s = s + cgi.escape(e) + '\n' + s = s + html.escape(e) + '\n' s = s + "</pre>\n" if filter: diff --git a/lib/python/mod_python/psp.py b/lib/python/mod_python/psp.py index f994847..cae778c 100644 --- a/lib/python/mod_python/psp.py +++ b/lib/python/mod_python/psp.py @@ -25,7 +25,7 @@ import sys import os import marshal import types -from cgi import escape +from html import escape import dbm, dbm import tempfile