diff --git a/Doc/Makefile.in b/Doc/Makefile.in index 705fe433..d13e703a 100644 --- a/Doc/Makefile.in +++ b/Doc/Makefile.in @@ -16,7 +16,7 @@ ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) .PHONY: help checkout update build html htmlhelp latex text changes linkcheck \ - suspicious coverage htmlview clean dist check serve \ + suspicious coverage htmlview distclean clean dist check serve \ autobuild-dev autobuild-stable help: @@ -102,6 +102,8 @@ coverage: build htmlview: html $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" +distclean: clean + clean: -rm -rf build/* -rm -rf tools/sphinx diff --git a/Doc/changes.rst b/Doc/changes.rst index 8b20d37c..aa4dfdd0 100644 --- a/Doc/changes.rst +++ b/Doc/changes.rst @@ -5,6 +5,22 @@ Changes ******* +.. _changes_from_3_4_1: + +Changes from version 3.4.1 +========================== + +New Features +------------ + +* Support for Python 3.3 + +Improvements +------------ + +* Simpler, faster and up-to-date with latest Python code for creating/maintaining interpreter and thread state. +* A much faster WSGI implementation (start_response now implemented in C) + .. _changes_from_3_3_1: Changes from version 3.3.1 diff --git a/configure b/configure index b0beb765..cee5b6af 100755 --- a/configure +++ b/configure @@ -3340,7 +3340,11 @@ PyMAJVERSION=`$PYTHON_BIN -c 'import sys; print(sys.version[:1])'` PyMINVERSION=`$PYTHON_BIN -c 'import sys; print(sys.version.split(".")[1])'` { $as_echo "$as_me:$LINENO: result: $PyVERSION" >&5 $as_echo "$PyVERSION" >&6; } - +if test -z "$PyMAJVERSION"; then + { { $as_echo "$as_me:$LINENO: error: Unable to get Python version - is your Python working?" >&5 +$as_echo "$as_me: error: Unable to get Python version - is your Python working?" >&2;} + { (exit 1); exit 1; }; } +fi # make sure Python version is >= 2.6 for 2 and >= 3.3 for 3 if test "$PyMAJVERSION" -lt "2"; then { { $as_echo "$as_me:$LINENO: error: This version of mod_python only works with Python major version 2 or higher. The one you have seems to be $PyVERSION." >&5 @@ -3391,7 +3395,8 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" if test "$PyMAJVERSION" -eq "3"; then - LDLIBS1="-lpython${PyMAJVERSION}" + PyLDVERSION=`$PYTHON_BIN -c 'from distutils import sysconfig; print(sysconfig.get_config_var("LDVERSION"))'` + LDLIBS1="-lpython${PyLDVERSION}" else LDLIBS1="-lpython${PyVERSION}" fi diff --git a/configure.in b/configure.in index 64f13d8c..28651654 100644 --- a/configure.in +++ b/configure.in @@ -171,7 +171,9 @@ 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])'`] AC_MSG_RESULT($PyVERSION) - +if test -z "$PyMAJVERSION"; then + AC_MSG_ERROR([Unable to get Python version - is your Python working?]) +fi # make sure Python version is >= 2.6 for 2 and >= 3.3 for 3 if test "$PyMAJVERSION" -lt "2"; then AC_MSG_ERROR([This version of mod_python only works with Python major version 2 or higher. The one you have seems to be $PyVERSION.]) @@ -216,7 +218,8 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" if test "$PyMAJVERSION" -eq "3"; then - LDLIBS1="-lpython${PyMAJVERSION}" + PyLDVERSION=`$PYTHON_BIN -c ['from distutils import sysconfig; print(sysconfig.get_config_var("LDVERSION"))'`] + LDLIBS1="-lpython${PyLDVERSION}" else LDLIBS1="-lpython${PyVERSION}" fi diff --git a/scripts/mod_python.in b/scripts/mod_python.in index 3c1a7b3c..610c84ad 100644 --- a/scripts/mod_python.in +++ b/scripts/mod_python.in @@ -26,7 +26,7 @@ import sys import os import platform -import StringIO +import io import mod_python from mod_python import httpdconf @@ -64,7 +64,7 @@ def cmd_genconfig(): if len(args) != 1: parser.error("Must specify ") - execfile(args[0]) + exec(compile(open(args[0]).read(), args[0], 'exec')) def cmd_create(): @@ -92,11 +92,11 @@ def cmd_create(): pythonpath=pythonpath, pythonoptions=options.pythonoptions, mp_comments=mp_comments) if conf_path: - print "\nCreated! Please look over %s." % `conf_path` - print "Remember to generate the Apache httpd config by running" - print "%s genconfig %s > %s" % (sys.argv[0], conf_path, - os.path.join(os.path.split(conf_path)[0], 'httpd.conf')) - print "From here on you can tweak %s and re-generate Apache config at any time." % `conf_path` + print("\nCreated! Please look over %s." % repr(conf_path)) + print("Remember to generate the Apache httpd config by running") + print("%s genconfig %s > %s" % (sys.argv[0], conf_path, + os.path.join(os.path.split(conf_path)[0], 'httpd.conf'))) + print("From here on you can tweak %s and re-generate Apache config at any time." % repr(conf_path)) def cmd_version(): @@ -105,15 +105,15 @@ def cmd_version(): version = "\n" version += "mod_python: %s\n" % mod_python.mp_version - version += " %s\n\n" % `os.path.join(mod_python.version.LIBEXECDIR, "mod_python.so")` + version += " %s\n\n" % repr(os.path.join(mod_python.version.LIBEXECDIR, "mod_python.so")) version += "python: %s\n" % ''.join(sys.version.splitlines()) - version += " %s\n\n" % `mod_python.version.PYTHON_BIN` + version += " %s\n\n" % repr(mod_python.version.PYTHON_BIN) version += "httpd: %s\n" % mod_python.version.HTTPD_VERSION - version += " %s\n\n" % `mod_python.version.HTTPD` + version += " %s\n\n" % repr(mod_python.version.HTTPD) version += "apr: %s\n" % mod_python.version.APR_VERSION version += "platform: %s\n" % platform.platform() - print version + print(version) import optparse diff --git a/src/include/mod_python.h b/src/include/mod_python.h index 061146bf..2c150d17 100644 --- a/src/include/mod_python.h +++ b/src/include/mod_python.h @@ -267,7 +267,7 @@ APR_DECLARE_OPTIONAL_FN(PyObject *, mp_get_connection_object, (conn_rec *)); if (PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3 && \ PyUnicode_KIND(obj) == PyUnicode_1BYTE_KIND) { \ if (obj_is_borrowed) Py_INCREF(obj); /* so DECREF ok */ \ - str = PyUnicode_1BYTE_DATA(obj); \ + str = (char *)PyUnicode_1BYTE_DATA(obj); \ } else { \ PyObject *latin = PyUnicode_AsLatin1String(obj); \ if (latin) { \ @@ -292,11 +292,11 @@ static inline PyObject *MpObject_ReprAsBytes(PyObject *o) { PyObject *result; PyObject *ucode = PyObject_Repr(o); /* we can do this because repr() should never have non-ascii characters XXX (really?) */ - char *c = PyUnicode_1BYTE_DATA(ucode); + char *c = (char *)PyUnicode_1BYTE_DATA(ucode); if (c[0] == 'b') - result = PyBytes_FromStringAndSize(PyUnicode_1BYTE_DATA(ucode)+1, PyUnicode_GET_LENGTH(ucode)-1); + result = PyBytes_FromStringAndSize((char *)PyUnicode_1BYTE_DATA(ucode)+1, PyUnicode_GET_LENGTH(ucode)-1); else - result = PyBytes_FromStringAndSize(PyUnicode_1BYTE_DATA(ucode), PyUnicode_GET_LENGTH(ucode)); + result = PyBytes_FromStringAndSize((char *)PyUnicode_1BYTE_DATA(ucode), PyUnicode_GET_LENGTH(ucode)); Py_DECREF(ucode); return result; } diff --git a/src/include/mod_python.h.in b/src/include/mod_python.h.in index 4b6f1fba..31b5517c 100644 --- a/src/include/mod_python.h.in +++ b/src/include/mod_python.h.in @@ -267,7 +267,7 @@ APR_DECLARE_OPTIONAL_FN(PyObject *, mp_get_connection_object, (conn_rec *)); if (PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 3 && \ PyUnicode_KIND(obj) == PyUnicode_1BYTE_KIND) { \ if (obj_is_borrowed) Py_INCREF(obj); /* so DECREF ok */ \ - str = PyUnicode_1BYTE_DATA(obj); \ + str = (char *)PyUnicode_1BYTE_DATA(obj); \ } else { \ PyObject *latin = PyUnicode_AsLatin1String(obj); \ if (latin) { \ @@ -292,11 +292,11 @@ static inline PyObject *MpObject_ReprAsBytes(PyObject *o) { PyObject *result; PyObject *ucode = PyObject_Repr(o); /* we can do this because repr() should never have non-ascii characters XXX (really?) */ - char *c = PyUnicode_1BYTE_DATA(ucode); + char *c = (char *)PyUnicode_1BYTE_DATA(ucode); if (c[0] == 'b') - result = PyBytes_FromStringAndSize(PyUnicode_1BYTE_DATA(ucode)+1, PyUnicode_GET_LENGTH(ucode)-1); + result = PyBytes_FromStringAndSize((char *)PyUnicode_1BYTE_DATA(ucode)+1, PyUnicode_GET_LENGTH(ucode)-1); else - result = PyBytes_FromStringAndSize(PyUnicode_1BYTE_DATA(ucode), PyUnicode_GET_LENGTH(ucode)); + result = PyBytes_FromStringAndSize((char *)PyUnicode_1BYTE_DATA(ucode), PyUnicode_GET_LENGTH(ucode)); Py_DECREF(ucode); return result; } diff --git a/src/mod_python.c b/src/mod_python.c index 5404084e..2fe01eaa 100644 --- a/src/mod_python.c +++ b/src/mod_python.c @@ -748,10 +748,10 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, py_compile_version, py_dynamic_version); ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "python_init: Python executable found '%s'.", - Py_GetProgramFullPath()); + (char *)Py_GetProgramFullPath()); ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "python_init: Python path being used '%s'.", - Py_GetPath()); + (char *)Py_GetPath()); } /* Python version */