Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10 support #114

Merged
merged 3 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ fi

# find out python version
AC_MSG_CHECKING(Python version)
PyVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:3])'`]
PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version[:1])'`]
PyMINVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version.split(".")[1])'`]
PyVERSION=`$PYTHON_BIN -c ['import sys; print('{}.{}'.format(*sys.version_info))'`]
PyMAJVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version_info.major)'`]
PyMINVERSION=`$PYTHON_BIN -c ['import sys; print(sys.version_info.minor)'`]
AC_MSG_RESULT($PyVERSION)

# make sure Python version is >= 2.6 for 2 and >= 3.3 for 3
Expand Down
4 changes: 2 additions & 2 deletions lib/python/mod_python/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##############################

Expand Down
4 changes: 2 additions & 2 deletions lib/python/mod_python/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ def __init__(self, req, keep_blank_values=0, strict_parsing=0, file_callback=Non
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()
Expand Down
2 changes: 1 addition & 1 deletion src/connobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/filterobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/include/mod_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*/

/* Python headers */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"

Expand Down
1 change: 1 addition & 0 deletions src/include/mod_python.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*/

/* Python headers */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"

Expand Down
2 changes: 1 addition & 1 deletion src/requestobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down