diff --git a/debian/changelog b/debian/changelog index eebb43b09d50dd06bf331074cca50281964ca662..0e2b5edaeb9a7f9c9e4b65a0e193b64ac4883380 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ libapache2-mod-python (3.5.0+git20211031.e6458ec-1) UNRELEASED; urgency=medium * Drop patches, superseded upstream: 04_html-escape.patch, 05_fix_spelling.patch, 07_fix-compilation-with-python-3.7.patch, 09_create-DESTDIR-BINDIR-if-needed.patch. + * Patches to add Python 3.10 support: (Closes: #1009243) + - 11_py310_py_ssize_t_clean.patch + - 12_py310_collections_import.patch -- Stefano Rivera <stefanor@debian.org> Sun, 17 Apr 2022 19:12:13 -0400 diff --git a/debian/patches/11_py310_py_ssize_t_clean.patch b/debian/patches/11_py310_py_ssize_t_clean.patch new file mode 100644 index 0000000000000000000000000000000000000000..1eb3b260ef4a2ef49cfd88e6b0cbc4d39a373657 --- /dev/null +++ b/debian/patches/11_py310_py_ssize_t_clean.patch @@ -0,0 +1,80 @@ +From: Andreas Hasenack <andreas.hasenack@ubuntu.com> +Date: Sun, 17 Apr 2022 19:30:27 -0400 +Subject: Make mod-python PY_SSIZE_T_CLEAN + +Required for Python 3.10 support. + +Bug-Debian: https://bugs.debian.org/1009243 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-python/+bug/1960088 +Forwarded: https://github.com/grisha/mod_python/pull/114 +--- + src/connobject.c | 2 +- + src/filterobject.c | 2 +- + src/include/mod_python.h | 1 + + src/include/mod_python.h.in | 1 + + src/requestobject.c | 2 +- + 5 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/connobject.c b/src/connobject.c +index 6f029a4..82cf195 100644 +--- a/src/connobject.c ++++ b/src/connobject.c +@@ -232,7 +232,7 @@ static PyObject * conn_readline(connobject *self, PyObject *args) + static PyObject * conn_write(connobject *self, PyObject *args) + { + char *buff; +- int len; ++ Py_ssize_t len; + apr_bucket_brigade *bb; + apr_bucket *b; + PyObject *s; +diff --git a/src/filterobject.c b/src/filterobject.c +index 966d2f8..712dbb4 100644 +--- a/src/filterobject.c ++++ b/src/filterobject.c +@@ -315,7 +315,7 @@ static PyObject *filter_write(filterobject *self, PyObject *args) + { + + char *buff; +- int len; ++ Py_ssize_t len; + apr_bucket *b; + PyObject *s; + conn_rec *c = self->request_obj->request_rec->connection; +diff --git a/src/include/mod_python.h b/src/include/mod_python.h +index 68a77d4..69f0214 100644 +--- a/src/include/mod_python.h ++++ b/src/include/mod_python.h +@@ -43,6 +43,7 @@ + */ + + /* Python headers */ ++#define PY_SSIZE_T_CLEAN + #include "Python.h" + #include "structmember.h" + +diff --git a/src/include/mod_python.h.in b/src/include/mod_python.h.in +index 7d536c5..8d97c47 100644 +--- a/src/include/mod_python.h.in ++++ b/src/include/mod_python.h.in +@@ -43,6 +43,7 @@ + */ + + /* Python headers */ ++#define PY_SSIZE_T_CLEAN + #include "Python.h" + #include "structmember.h" + +diff --git a/src/requestobject.c b/src/requestobject.c +index 65d42ac..38b7165 100644 +--- a/src/requestobject.c ++++ b/src/requestobject.c +@@ -1576,7 +1576,7 @@ static PyObject * req_update_mtime(requestobject *self, PyObject *args) + + static PyObject * req_write(requestobject *self, PyObject *args) + { +- int len; ++ Py_ssize_t len; + int rc; + char *buff; + int flush=1; diff --git a/debian/patches/12_py310_collections_import.patch b/debian/patches/12_py310_collections_import.patch new file mode 100644 index 0000000000000000000000000000000000000000..42026e8b215c9338fbb85cdbfa1c98343f3ec1c7 --- /dev/null +++ b/debian/patches/12_py310_collections_import.patch @@ -0,0 +1,46 @@ +From: Andreas Hasenack <andreas.hasenack@ubuntu.com> +Date: Sun, 17 Apr 2022 19:31:55 -0400 +Subject: Python 3.10 support: import Callable from collections.abc + +Bug-Debian: https://bugs.debian.org/1009243 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-python/+bug/1960088 +Forwarded: https://github.com/grisha/mod_python/pull/114 +--- + lib/python/mod_python/publisher.py | 4 ++-- + lib/python/mod_python/util.py | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/lib/python/mod_python/publisher.py b/lib/python/mod_python/publisher.py +index 75d103f..5882e77 100644 +--- a/lib/python/mod_python/publisher.py ++++ b/lib/python/mod_python/publisher.py +@@ -51,8 +51,8 @@ def _callable(obj): + if PY2: + return callable(obj) + else: +- return (isinstance(obj, collections.Callable) or +- (hasattr(obj, "__call__") and isinstance(obj.__call__, collections.Callable))) ++ return (isinstance(obj, collections.abc.Callable) or ++ (hasattr(obj, "__call__") and isinstance(obj.__call__, collections.abc.Callable))) + + ####################### The published page cache ############################## + +diff --git a/lib/python/mod_python/util.py b/lib/python/mod_python/util.py +index 67d6b3f..30601a5 100644 +--- a/lib/python/mod_python/util.py ++++ b/lib/python/mod_python/util.py +@@ -368,12 +368,12 @@ class FieldStorage: + filename = None + if b"filename" in disp_options: + filename = disp_options[b"filename"] +- if file_callback and isinstance(file_callback, collections.Callable): ++ if file_callback and isinstance(file_callback, collections.abc.Callable): + file = file_callback(filename) + else: + file = tempfile.TemporaryFile("w+b") + else: +- if field_callback and isinstance(field_callback, collections.Callable): ++ if field_callback and isinstance(field_callback, collections.abc.Callable): + file = field_callback() + else: + file = BytesIO() diff --git a/debian/patches/series b/debian/patches/series index f4d09b9e91c091bb79a9016295a28a0bfe376759..719bc7c1eca964ca8f3794aaa150ba41d17f5335 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,5 @@ 02_makefile.patch 03_ignore-git-version.patch 10_make-package-reproducible.patch +11_py310_py_ssize_t_clean.patch +12_py310_collections_import.patch