1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 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;
|