diff --git a/Doc/conf.py b/Doc/conf.py index 114789a0..0176928e 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -57,11 +57,6 @@ # typographically correct entities. html_use_smartypants = True -# Custom sidebar templates, filenames relative to this file. -html_sidebars = { - 'index': 'indexsidebar.html', -} - # Output file base name for HTML help builder. htmlhelp_basename = 'mod_python' + release.replace('.', '') diff --git a/Doc/copyright.rst b/Doc/copyright.rst index f770901c..ce3cb009 100644 --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Copyright Mod_python and this documentation is: -Copyright © 2000, 2001, 2013 Gregory Trubetskoy +Copyright © 2000, 2001, 2013, 2024 Gregory Trubetskoy Copyright © 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation diff --git a/Makefile.in b/Makefile.in index df6afa4d..8e08617b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -61,7 +61,7 @@ install_dso: dso @echo "Performing DSO installation." @echo $(INSTALL) -d $(DESTDIR)$(LIBEXECDIR) - $(INSTALL) src/mod_python.so $(DESTDIR)$(LIBEXECDIR) + $(INSTALL) -m 0644 src/mod_python.so $(DESTDIR)$(LIBEXECDIR) install_py_lib: cd dist && $(MAKE) install_py_lib @@ -80,7 +80,7 @@ distclean: clean cd scripts && $(MAKE) distclean cd test && $(MAKE) distclean rm -rf Makefile config.h config.status config.cache config.log \ - test/testconf.py + test/testconf.py test: @ALL@ cd test && $(MAKE) test diff --git a/NEWS b/NEWS index 198fa665..797dc0e1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,20 @@ +Jan 23 2026 - 3.5.0.7 32-bit compile fix + +Dec 30 2025 - 3.5.0.6 Fix publisher query string bug + +Nov 8 2025 - 3.5.0.5 Compatibility with Python 3.13 and 3.14. + +Sep 5 2024 - 3.5.0.4 fix sys.version bug and quiet compiler warnings. + +May 7 2024 - 3.5.0.3 release tagged, it addresses test failures and + restores 2.7 compatibility. + +Feb 25 2024 - 3.5.0.2 released. Address the deprecation of the imp module in + Python 3.12. + +Aug 18 2023 - 3.5.0.1 released. It addresses compatibility issues with + Python 3.11. + Nov 13 2013 - 3.5.0 released Oct 22 2013 - 3.4.1 released @@ -12,47 +29,47 @@ July 19 2006 - 3.2.10 is being tagged from branches/3.2.x July 19 2006 - The public release of 3.2.9 is being abandoned due to some recently reported memory leaks. Although 3.2.9 is ready for - release, it is felt that it is prudent to address these now - and proceed immediately to 3.2.10. See MODPYTHON-172 for - on the specific details on the issues. + release, it is felt that it is prudent to address these now + and proceed immediately to 3.2.10. See MODPYTHON-172 for + on the specific details on the issues. -June 29 2006 - 3.2.9 is being tagged from branches/3.2.x +June 29 2006 - 3.2.9 is being tagged from branches/3.2.x -Feb 19 2006 - 3.2.8 is being tagged from branches/3.2.x +Feb 19 2006 - 3.2.8 is being tagged from branches/3.2.x 3.2.8 is a security release to fix the possible - directory traversal attack in FileSession. + directory traversal attack in FileSession. Feb 9 2006 - Created 3.2.x stable bugfix branch in svn as branches/3.2.x -Feb 3 2006 - 3.2.7 is being tagged +Feb 3 2006 - 3.2.7 is being tagged -Jan 16 2006 - 3.2.6 final is being tagged (no changes from 3.2.6b) +Jan 16 2006 - 3.2.6 final is being tagged (no changes from 3.2.6b) -Jan 14 2006 - 3.2.6b is being tagged +Jan 14 2006 - 3.2.6b is being tagged -Nov 15 2005 - 3.2.5b is being tagged +Nov 15 2005 - 3.2.5b is being tagged -Oct 28 2005 - 3.2.4b is being tagged +Oct 28 2005 - 3.2.4b is being tagged -Oct 22 2005 - 3.2.3b is being tagged +Oct 22 2005 - 3.2.3b is being tagged -Sep 13 2005 - 3.2.2b is being tagged +Sep 13 2005 - 3.2.2b is being tagged -Sep 6 2005 - 3.2.1b is being tagged +Sep 6 2005 - 3.2.1b is being tagged Aug 16 2005 - 3.2.0b is being tagged -Feb 17 2004 - 3.1.3 is being tagged +Feb 17 2004 - 3.1.3 is being tagged -Oct 14 2003 - 3.1.1b is tagged +Oct 14 2003 - 3.1.1b is tagged -Aug 29 2003 - 3.1.0a (Alpha) is out +Aug 29 2003 - 3.1.0a (Alpha) is out -Mar 17 2003 - 3.0.3 is released +Mar 17 2003 - 3.0.3 is released - This file will no longer have details, since those - are in CVS anyway. + This file will no longer have details, since those + are in CVS anyway. Feb 12 2003 - Added a test for req.headers_out @@ -91,170 +108,170 @@ Nov 26 2002 - 3.0.1 is about to be released. This was file has not been updated during the 3.0 development because of too many things changing. -Nov 28 2001 - Now compiles against Apache 2.0.28 +Nov 28 2001 - Now compiles against Apache 2.0.28 -Nov 6 2001 - More internal changes. Bugs from previous change, cleaner - reference keeping. +Nov 6 2001 - More internal changes. Bugs from previous change, cleaner + reference keeping. -Nov 1 2001 - Many internal changes. We no longer use req->notes for things - that shouldn't be there, handler directives can be restricted - to specific file extensions thereby allowing multiple handlers - per directory, etc. The config is now stored in a new hlist - object, which can be accessed from python via an hlistobject. +Nov 1 2001 - Many internal changes. We no longer use req->notes for things + that shouldn't be there, handler directives can be restricted + to specific file extensions thereby allowing multiple handlers + per directory, etc. The config is now stored in a new hlist + object, which can be accessed from python via an hlistobject. Aug 16 2001 - Mod_python is compiling and running with Apache 2.0 and the - filter functionality seems to work. There is still a lot of - work to be done though. + filter functionality seems to work. There is still a lot of + work to be done though. Aug 4 2001 - 2.7.6 released. Sometime prior a publisher upload bug was fixed. -Jun 11 2001 - 2.7.5 released for those who want Python 2.1 +Jun 11 2001 - 2.7.5 released for those who want Python 2.1 -Jun 11 2001 - Changed configure.in to accomodate Python 2.1. It looks like - everything else works without any changes. +Jun 11 2001 - Changed configure.in to accomodate Python 2.1. It looks like + everything else works without any changes. -Jun 4 2001 - 2.7.4 released. +Jun 4 2001 - 2.7.4 released. -May 28 2001 - Renamed make_table, log_error, table_add and copy_table with - mp_ so as to not get confused with the ones in ap_compat.h +May 28 2001 - Renamed make_table, log_error, table_add and copy_table with + mp_ so as to not get confused with the ones in ap_compat.h -May 24 2001 - PythonNoReload obsoleted in favor of PythonAutoReload. +May 24 2001 - PythonNoReload obsoleted in favor of PythonAutoReload. -May 23 2001 - The "fix" re import on Apr 10 turned out to be a bug and - I put it back. But in the process found that the FLAG directives - were not read correctly - e.g. mere presence sometimes indicated - On. Also, ReportError was returning DONE in finally clause which - was wrong. +May 23 2001 - The "fix" re import on Apr 10 turned out to be a bug and + I put it back. But in the process found that the FLAG directives + were not read correctly - e.g. mere presence sometimes indicated + On. Also, ReportError was returning DONE in finally clause which + was wrong. May 22 2001 - The bug that was supposedly fixed below was a bit more - complicated than it seemed at first. The fix below caused - a circular reference, and some further fixing had to be done, - and now it's really fixed, thanks to Chris's dilligence. + complicated than it seemed at first. The fix below caused + a circular reference, and some further fixing had to be done, + and now it's really fixed, thanks to Chris's dilligence. -May 17 2001 - Fixed a threading bug reported by Chris Trengove where - the callback object could have the reference to self.req - overwritten by other threads. The reference to the Request - object is now stored inside the requestobject C structure. +May 17 2001 - Fixed a threading bug reported by Chris Trengove where + the callback object could have the reference to self.req + overwritten by other threads. The reference to the Request + object is now stored inside the requestobject C structure. -May 12 2001 - 2.7.3 released +May 12 2001 - 2.7.3 released -Apr 10 2001 - Fixed a PythonImport bug reported by Chris Hagner. Removed - the atol hack as per Miguel Marques patch. Fixed apache.py - to use a messier looking but for some obscure reason that - now escapes me necessary way of importing modules via imp. +Apr 10 2001 - Fixed a PythonImport bug reported by Chris Hagner. Removed + the atol hack as per Miguel Marques patch. Fixed apache.py + to use a messier looking but for some obscure reason that + now escapes me necessary way of importing modules via imp. Apr 7 2001 - "Dissapearing args" on Solaris fixed. It was a problem - in parse_qsl. + in parse_qsl. Apr 6 2001 - Missing _eprintf() on Solaris/gcc workaround added. I - wonder if this applies to other OS's? + wonder if this applies to other OS's? -Apr 5 2001 - A couple doc fixes. +Apr 5 2001 - A couple doc fixes. -Feb 10 2001 - 2.7.2 released +Feb 10 2001 - 2.7.2 released Feb 10 2001 - Fixed the dissapearing / in PATH_INFO. -Jan 23 2001 - Fixed the bug where req.server.register_cleanup was - expecting a builtin _req object rather than the new real - Python Request. +Jan 23 2001 - Fixed the bug where req.server.register_cleanup was + expecting a builtin _req object rather than the new real + Python Request. -Jan 21 2001 - The Publisher handler __auth__ can now be a dictionary or. - a const. There is also new __access__, which can be a list. +Jan 21 2001 - The Publisher handler __auth__ can now be a dictionary or. + a const. There is also new __access__, which can be a list. -Jan 19 2001 - Added req._content_type_set flag which is set to 1 when - a value is assigned to content_type from Python. This way - the publisher handler can know if it's been purposely set - and will not attempt to guess it. +Jan 19 2001 - Added req._content_type_set flag which is set to 1 when + a value is assigned to content_type from Python. This way + the publisher handler can know if it's been purposely set + and will not attempt to guess it. -Jan 18 2001 - Documented req.form. Fixed a security problem with the - Publisher handler - it now does not allow modules to be - published, so a user can't access test.os.renames, etc. +Jan 18 2001 - Documented req.form. Fixed a security problem with the + Publisher handler - it now does not allow modules to be + published, so a user can't access test.os.renames, etc. -Dec 18 2000 - 2.7 had a typo in it + win32 wants types initialized - separately like I thought. Time for 2.7.1. +Dec 18 2000 - 2.7 had a typo in it + win32 wants types initialized + separately like I thought. Time for 2.7.1. -Dec 16 2000 - Releasing 2.7.... +Dec 16 2000 - Releasing 2.7.... Dec 16 2000 - Found another bug related to ALLOW_THREADS macros which are - noops without threads, but that is actually wrong, because - what they is needed wvwn without threads. Also, some days - ago 2.6.4 was released. + noops without threads, but that is actually wrong, because + what they is needed wvwn without threads. Also, some days + ago 2.6.4 was released. -Dec 13 2000 - The initial documentation for the util module and for the - publisher handler is done. Perhaps the tutorial should have - a bit on the publisher handler. +Dec 13 2000 - The initial documentation for the util module and for the + publisher handler is done. Perhaps the tutorial should have + a bit on the publisher handler. -Dec 12 2000 - publisher handler appears to be working pretty well. Now need - to document it. +Dec 12 2000 - publisher handler appears to be working pretty well. Now need + to document it. -Dec 11 2000 - It appears I found a big booboo with mispalced #ifdef - WITH_THREADS... The "Dispatch returned nothing" should be - gone now. This means 2.6.3 has major problems with multiple - interpreters. +Dec 11 2000 - It appears I found a big booboo with mispalced #ifdef + WITH_THREADS... The "Dispatch returned nothing" should be + gone now. This means 2.6.3 has major problems with multiple + interpreters. Dec 8 2000 - connection.user now writable. More Doc improvements. -Dec 6 2000 - The COPYRIGHT no longer has the advertizing clause. +Dec 6 2000 - The COPYRIGHT no longer has the advertizing clause. -Dec 4 2000 - Initial (not proof-read) LaTeX source for documentation is - checked in. +Dec 4 2000 - Initial (not proof-read) LaTeX source for documentation is + checked in. -Nov 26 2000 - Dilligently migrating all the documentation to LaTeX using the - Python standards. +Nov 26 2000 - Dilligently migrating all the documentation to LaTeX using the + Python standards. -Nov 17 2000 - I forgot to uncomment type initialization. type(req.headers_in) - would segfault. Fixed. Continuing work on publisher.py module. +Nov 17 2000 - I forgot to uncomment type initialization. type(req.headers_in) + would segfault. Fixed. Continuing work on publisher.py module. -Nov 08 2000 - read() and reqadline() now behave very much like the standard - Python file object counterparts. Added James Gessling's VMS - instructions. +Nov 08 2000 - read() and reqadline() now behave very much like the standard + Python file object counterparts. Added James Gessling's VMS + instructions. -Nov 07 2000 - Initial version of req.readline(), also some fixes to - req.read() (both now raise appropriate errors). Both still need - some work. +Nov 07 2000 - Initial version of req.readline(), also some fixes to + req.read() (both now raise appropriate errors). Both still need + some work. -Nov 04 2000 - Implemented _apache.parse_qs. Also, CGIStin had a read() bug. - PythonHandlerModule is documented. +Nov 04 2000 - Implemented _apache.parse_qs. Also, CGIStin had a read() bug. + PythonHandlerModule is documented. -Oct 30 2000 - Implemented PythonHandlerModule. Still need to document it. +Oct 30 2000 - Implemented PythonHandlerModule. Still need to document it. -Oct 29 2000 - 2.6.3 release. Mostly static install bug fixes. +Oct 29 2000 - 2.6.3 release. Mostly static install bug fixes. Oct 22 2000 - 2.6.2 release Oct 22 2000 - "Fatal Python error: PyThreadState_Get: no current thread" upon - exit is now fixed. Also, --with-python was improved to point - to the right Makefile (Modules/Makefile) when scanning for LIBS. + exit is now fixed. Also, --with-python was improved to point + to the right Makefile (Modules/Makefile) when scanning for LIBS. Oct 21 2000 - 2.6.1 release -Oct 20 2000 - Fixed some minor installation bugs. +Oct 20 2000 - Fixed some minor installation bugs. Oct 19 2000 - 2.6 out -Oct 16 2000 - Began a major file reorganization. All objects are now in - separate files, and all external functions have an Mp prefix - and named consistently with Python C API conventions. +Oct 16 2000 - Began a major file reorganization. All objects are now in + separate files, and all external functions have an Mp prefix + and named consistently with Python C API conventions. -Oct 15 2000 - We now use mkdep. +Oct 15 2000 - We now use mkdep. Oct 12 2000 - Autoconf now works. Documentation has been adjusted. Also - added Windows installation instructions to the docs. + added Windows installation instructions to the docs. Oct 2 2000 - PythonInterpPerServer is now default behavior, and this - directive is therefore obsolete. The old default behavior can - be achieved via the new PythonInterpPerDirective directive. + directive is therefore obsolete. The old default behavior can + be achieved via the new PythonInterpPerDirective directive. Sep ? 2000 - Request is now a real python object. This means that it can be - used to retain state between requests. + used to retain state between requests. Sep 9 2000 - Added server.register_cleanup(). This happened to be a little - trickier than I thought since it turned out that server_rec does - not have a pool member. Py_Finalze() has been moved to a - cleanup from the ChildExit handler because ChildExit runs *before* - any cleanups. (Now I know why mod_perl doesn't use child_exit.) + trickier than I thought since it turned out that server_rec does + not have a pool member. Py_Finalze() has been moved to a + cleanup from the ChildExit handler because ChildExit runs *before* + any cleanups. (Now I know why mod_perl doesn't use child_exit.) Sep 8 2000 - Sean True's fix to call note_basic_auth_failure added. @@ -265,38 +282,38 @@ Sep 5 2000 - 2.5 released. Sep 4 2000 - Added the PythonCleanupHandler. Sep 4 2000 - Added req.register_cleanup(). Still need server.register_cleanup(), - as well as a PythonCleanupHandler. + as well as a PythonCleanupHandler. Sep 2 2000 - Added PythonInterpPerServer directive. Fixed a bug relating - to ap_add_version_component. + to ap_add_version_component. -Aug 28 2000 - Added Richard Barret's patch that gives python socket module - behaviour from req.connection.local_addr and remote_addr. +Aug 28 2000 - Added Richard Barret's patch that gives python socket module + behaviour from req.connection.local_addr and remote_addr. Aug 27 2000 - Added PythonInitHandler. Also, it looks like dynamic handler - addition now works correctly, after trying 15 different ways of - implementing it, resorting to req->notes seems to be the only - option. + addition now works correctly, after trying 15 different ways of + implementing it, resorting to req->notes seems to be the only + option. Aug 18 2000 - Added req.get_remote_host() Aug 16 2000 - Added Dr. Timochouk's PythonOptimize directive patch. Aug 15 2000 - Extensive improvements to req.read() prompted by Dr. Timochouk's - patches. + patches. -Aug 10 2000 - Documentation change - get_basic_auth_pw must be called before - using connection.user. +Aug 10 2000 - Documentation change - get_basic_auth_pw must be called before + using connection.user. Aug 06 2000 - Table oject now has a new method "add" which allows creation - of multiple keys. This is useful with things like "Set-Cookie" - headers. + of multiple keys. This is useful with things like "Set-Cookie" + headers. Jul 22 2000 - Added req.add_handler (dynamic handler registration) Jul 18 2000 - Added PythonEnablePdb - ChildExitHandler now properly calls Py_Finalize() - python_handler is now cumulative rather than overriding + ChildExitHandler now properly calls Py_Finalize() + python_handler is now cumulative rather than overriding Jul 04 2000 - 2.4.1 Released. Mostly bug fixes. Should be pretty stable. @@ -305,16 +322,16 @@ Jun 20 2000 - 2.4 Released. Jun 17 2000 - Started the tutorial.html. Jun 11 2000 - Stephane Bidoul's thread-safe win32 changes put in. As part - of this, all chdir()'s are gone and now instead of '.', the - file path is prepended to pythonpath. + of this, all chdir()'s are gone and now instead of '.', the + file path is prepended to pythonpath. Jun 8 2000 - 2.3 Released. -Jun 7 2000 - PythonImport now works. +Jun 7 2000 - PythonImport now works. -Jun 5 2000 - PythonDebug and other on/off type handlers are now of type FLAG - so they require an argument of On or Off. +Jun 5 2000 - PythonDebug and other on/off type handlers are now of type FLAG + so they require an argument of On or Off. -Apr 2000 - rename to mod_python and go apache-specific. -Nov 1998 - support for multiple interpreters introduced. -May 1998 - initial release (httpdapy). +Apr 2000 - rename to mod_python and go apache-specific. +Nov 1998 - support for multiple interpreters introduced. +May 1998 - initial release (httpdapy). diff --git a/README.md b/README.md index 3a9a9958..adc5f78f 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ mod_python Documentation for mod_python is on http://www.modpython.org/ +Mod_python is going to be maintained on GitHub from here on. For issues and questions +please use GitHub. + Quick Start ----------- @@ -16,22 +19,3 @@ $ make test ``` If the above worked - read the tutorial in the documentation. - -OS Hints --------- - -### Windows: - -HELP NEEDED! I do not have access to a Windows development -environment. If you get a Windows compile working, please create a -pull request or drop a note on the mod_python mailing list: -mod_python@modpython.org (Note: subscription required). - -### Mac OS X/Darwin: - -At least on OS X 10.8.5, the following was required in order for compile to work: - -```shell -sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain \ - /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain -``` diff --git a/configure b/configure index 49c670b2..2695f2b3 100755 --- a/configure +++ b/configure @@ -552,6 +552,66 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" +as_awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) && length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + d1 = substr(v1, 1, 1); v1 = substr(v1, 2) + d2 = substr(v2, 1, 1); v2 = substr(v2, 2) + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), + # which mishandles some comparisons of empty strings to integers. + if (length(v2)) exit 1 + if (length(v1)) exit 2 + } +' test -n "$DJDIR" || exec 7<&0 &1 @@ -1828,6 +1888,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + # includes INCLUDES="-I`pwd`/src/include" @@ -3135,8 +3196,9 @@ fi # check for Python executable if test -z "$PYTHON_BIN"; then - # Extract the first word of "python", so it can be a program name with args. -set dummy python; ac_word=$2 + for python in python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do + # Extract the first word of "$python", so it can be a program name with args. +set dummy $python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON_BIN+:} false; then : @@ -3175,9 +3237,36 @@ $as_echo "no" >&6; } fi - if test -z "$PYTHON_BIN"; then - as_fn_error $? "python binary not found in path" "$LINENO" 5 + if test -n "$PYTHON_BIN"; then + break fi + done +fi + +if test -z "$PYTHON_BIN"; then + as_fn_error $? "python binary not found in path" "$LINENO" 5 +else + as_ac_File=`$as_echo "ac_cv_file_${PYTHON_BIN}-config" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PYTHON_BIN}-config" >&5 +$as_echo_n "checking for ${PYTHON_BIN}-config... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "${PYTHON_BIN}-config"; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + PYTHON_CONFIG=${PYTHON_BIN}-config +fi + fi # find out python version @@ -3204,35 +3293,39 @@ if test "$PyMAJVERSION" -eq "3"; then fi fi -# calculate compiler options -CPPFLAGS1=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print("-I" + sysconfig.get_config_var("INCLUDEPY"))'` - -CPPFLAGS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(" ".join(filter(lambda x: x.startswith("-D"), \ - sysconfig.get_config_var("CFLAGS").split())))'` - -CPPFLAGS="${CPPFLAGS1} ${CPPFLAGS2}" - - - -PYTHONFRAMEWORKDIR=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'` -PYTHONFRAMEWORKPREFIX=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX"))'` -PYTHONFRAMEWORK=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORK"))'` - -if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then - # this directory may contain the .so library, our preference, list 1st - LDFLAGS1=`${PYTHON_BIN} -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_config_var("LIBDIR"))'` - LDFLAGS2=`${PYTHON_BIN} -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1, \ - standard_lib=1) +"/config")'` - LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" +if test -n "$PYTHON_CONFIG" -a "$PyMAJVERSION" -gt "2"; then # 2.7.18 python-config missies the -L and does not support --embed + CPPFLAGS=`${PYTHON_CONFIG} --includes` + LDFLAGS=`${PYTHON_CONFIG} --ldflags --embed` + LDLIBS="" +else - PYTHON_CODE=$(cat <&6; { $as_echo "$as_me:${as_lineno-$LINENO}: checking flex version" >&5 $as_echo_n "checking flex version... " >&6; } FlexVERSION=`$LEX --version | sed 's/version//g' | awk '/flex/ {print $2}'` - Flex_MAJOR=`echo $FlexVERSION| awk -F. '{print $1}'` - Flex_MINOR=`echo $FlexVERSION| awk -F. '{print $2}'` - Flex_PATCH=`echo $FlexVERSION| awk -F. '{print $3}'` - if test "$Flex_MAJOR" -eq "2" && test "$Flex_MINOR" -eq "5" && test "$Flex_PATCH" -ge "31"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FlexVERSION. Good" >&5 -$as_echo "$FlexVERSION. Good" >&6; } - else + as_arg_v1=${FlexVERSION} +as_arg_v2="2.5.31" +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +case $? in #( + 1) : + warn=1 ;; #( + 0) : + warn=0 ;; #( + 2) : + warn=0 ;; #( + *) : + ;; +esac + if test "$warn" -eq "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Flex version $FlexVERSION found. Version 2.5.31 or greater is required. You can generally ignore this warning unless you need to regenerate psp_parser.c from psp_parse.l. @@ -3431,6 +3534,9 @@ $as_echo "$as_me: WARNING: Flex version $FlexVERSION found. warning unless you need to regenerate psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c, use --with-flex to specify the location of the correct flex version. See the README for more information." >&2;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FlexVERSION. Good" >&5 +$as_echo "$FlexVERSION. Good" >&6; } fi else diff --git a/configure.in b/configure.in index e2ac977c..08a696e4 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,7 +17,8 @@ # dnl Process this file with autoconf to produce a configure script. -AC_INIT(src/mod_python.c) +AC_INIT +AC_CONFIG_SRCDIR([src/mod_python.c]) # includes INCLUDES="-I`pwd`/src/include" @@ -42,14 +43,13 @@ AC_MSG_CHECKING(your blood pressure) AC_MSG_RESULT([a bit high, but we can proceed]) ## The goal is to find apxs -AC_CHECKING(whether apxs is available) +AS_MESSAGE([checking whether apxs is available...]) AC_SUBST(APXS) AC_SUBST(DSO) AC_SUBST(ALL) # check for --with-apxs -AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME], - [name of the apxs executable [[apxs]]]), +AC_ARG_WITH(apxs, AS_HELP_STRING([--with-apxs=NAME],[name of the apxs executable [[apxs]]]), [APXS="$with_apxs"]) if test -z "${APXS}"; then @@ -159,10 +159,18 @@ AC_MSG_RESULT(no)) # check for Python executable if test -z "$PYTHON_BIN"; then - AC_PATH_PROG(PYTHON_BIN, python) - if test -z "$PYTHON_BIN"; then - AC_MSG_ERROR(python binary not found in path) + for python in python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do + AC_PATH_PROG(PYTHON_BIN, [$python]) + if test -n "$PYTHON_BIN"; then + break fi + done +fi + +if test -z "$PYTHON_BIN"; then + AC_MSG_ERROR(python binary not found in path) +else + AC_CHECK_FILE([${PYTHON_BIN}]-config, PYTHON_CONFIG=[${PYTHON_BIN}]-config) fi # find out python version @@ -187,35 +195,39 @@ if test "$PyMAJVERSION" -eq "3"; then fi fi -# calculate compiler options -CPPFLAGS1=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print("-I" + sysconfig.get_config_var("INCLUDEPY"))'` - -CPPFLAGS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(" ".join(filter(lambda x: x.startswith("-D"), \ - sysconfig.get_config_var("CFLAGS").split())))'` - -CPPFLAGS="${CPPFLAGS1} ${CPPFLAGS2}" - -AC_SUBST(CPPFLAGS) +if test -n "$PYTHON_CONFIG" -a "$PyMAJVERSION" -gt "2"; then # 2.7.18 python-config missies the -L and does not support --embed + CPPFLAGS=`${PYTHON_CONFIG} --includes` + LDFLAGS=`${PYTHON_CONFIG} --ldflags --embed` + LDLIBS="" +else -PYTHONFRAMEWORKDIR=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'` -PYTHONFRAMEWORKPREFIX=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX"))'` -PYTHONFRAMEWORK=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("PYTHONFRAMEWORK"))'` - -if test "${PYTHONFRAMEWORKDIR}" = "no-framework"; then - # this directory may contain the .so library, our preference, list 1st - LDFLAGS1=`${PYTHON_BIN} -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_config_var("LIBDIR"))'` - LDFLAGS2=`${PYTHON_BIN} -c 'import distutils.sysconfig; \ - print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1, \ - standard_lib=1) +"/config")'` - LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" - - PYTHON_CODE=$(cat <@) END ) - LDLIBS1=`${PYTHON_BIN} -c "$PYTHON_CODE"` - LDLIBS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("LIBS"))'` + LDLIBS1=`${PYTHON_BIN} -c "$PYTHON_CODE"` + LDLIBS2=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ + print(sysconfig.get_config_var("LIBS"))'` - LDLIBS="${LDLIBS1} ${LDLIBS2}" -else - LDFLAGS1="-Wl,-F${PYTHONFRAMEWORKPREFIX} -framework ${PYTHONFRAMEWORK}" + LDLIBS="${LDLIBS1} ${LDLIBS2}" + else + LDFLAGS1="-Wl,-F${PYTHONFRAMEWORKPREFIX} -framework ${PYTHONFRAMEWORK}" - STRING="${PYTHONFRAMEWORKDIR}/Versions/${PyVERSION}/${PYTHONFRAMEWORK}" - LDFLAGS2=`${PYTHON_BIN} -c "from distutils import sysconfig; \ - print(sysconfig.get_config_var(\"LINKFORSHARED\").replace( \ - \"${STRING}\", ''))"` + STRING="${PYTHONFRAMEWORKDIR}/Versions/${PyVERSION}/${PYTHONFRAMEWORK}" + LDFLAGS2=`${PYTHON_BIN} -c "from distutils import sysconfig; \ + print(sysconfig.get_config_var(\"LINKFORSHARED\").replace( \ + \"${STRING}\", ''))"` - LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" + LDFLAGS="${LDFLAGS1} ${LDFLAGS2}" - LDLIBS=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ - print(sysconfig.get_config_var("LIBS"))'` + LDLIBS=`${PYTHON_BIN} -c 'from distutils import sysconfig; \ + print(sysconfig.get_config_var("LIBS"))'` + fi fi CFLAGS="" @@ -261,6 +274,8 @@ if test -x /usr/bin/lipo; then LDFLAGS="${LDFLAGS3} ${LDFLAGS}" fi +AC_SUBST(CPPFLAGS) + AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(LDLIBS) @@ -333,18 +348,16 @@ if test "$LEX" && test -x "$LEX"; then AC_MSG_CHECKING(flex version) FlexVERSION=`$LEX --version | sed 's/version//g' | awk '/flex/ {print $2}'` - Flex_MAJOR=`echo $FlexVERSION| awk -F. '{print $1}'` - Flex_MINOR=`echo $FlexVERSION| awk -F. '{print $2}'` - Flex_PATCH=`echo $FlexVERSION| awk -F. '{print $3}'` - if test "$Flex_MAJOR" -eq "2" && test "$Flex_MINOR" -eq "5" && test "$Flex_PATCH" -ge "31"; then - AC_MSG_RESULT([$FlexVERSION. Good]) - else + AS_VERSION_COMPARE(${FlexVERSION}, "2.5.31", [warn=1], [warn=0], [warn=0]) + if test "$warn" -eq "1"; then AC_MSG_WARN([Flex version $FlexVERSION found. Version 2.5.31 or greater is required. You can generally ignore this warning unless you need to regenerate psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c, use --with-flex to specify the location of the correct flex version. See the README for more information.]) + else + AC_MSG_RESULT([$FlexVERSION. Good]) fi else diff --git a/dist/setup.py.in b/dist/setup.py.in index 68581f36..bdc2d22d 100644 --- a/dist/setup.py.in +++ b/dist/setup.py.in @@ -16,9 +16,16 @@ # # $Id: setup.py.in 475516 2006-11-16 01:12:40Z grahamd $ -from distutils.core import setup, Extension - import sys +if sys.version_info[0]*100 + sys.version_info[1] > 310: + from setuptools import setup, Extension + import sysconfig +else: + from distutils.core import setup, Extension + from distutils import sysconfig + + +import string import re import os.path if sys.version[0] == '2': @@ -183,9 +190,6 @@ else: data_files = [] ext_modules = [PSPModule] -import string -from distutils import sysconfig - generate_version_py() if sys.platform == "darwin": diff --git a/dist/version.sh b/dist/version.sh index e50000d2..cf99e2a4 100755 --- a/dist/version.sh +++ b/dist/version.sh @@ -13,7 +13,7 @@ if type git >/dev/null 2>&1; then # but not on a tag (which means this is a release) if test -z "`git log 'HEAD^!' --format=%d 2>/dev/null | grep 'tag: '`"; then # append git revision hash to version - GIT="-`git describe --always`" + GIT="+`git describe --always --exclude '*'`" fi fi fi diff --git a/dist/win32_postinstall.py b/dist/win32_postinstall.py index 2a959343..fed1a67e 100644 --- a/dist/win32_postinstall.py +++ b/dist/win32_postinstall.py @@ -21,7 +21,6 @@ import sys, os, shutil -import distutils.sysconfig def getApacheDirOptions(): """find potential apache directories in the registry...""" @@ -102,7 +101,13 @@ def askForApacheDir(apachediroptions): # if we're called during removal, just exit if len(sys.argv) == 1 or (len(sys.argv) > 1 and sys.argv[1] != "-remove"): - mp = os.path.join(distutils.sysconfig.get_python_lib(), "mod_python_so.pyd") + if sys.version_info[0]*100 + sys.version_info[1] > 310: + import sysconfig + lib = get_path('platlib') + else: + import distutils.sysconfig + lib = distutils.sysconfig.get_python_lib() + mp = os.path.join(lib, "mod_python_so.pyd") apachediroptions = getApacheDirOptions() diff --git a/lib/python/mod_python/Cookie.py b/lib/python/mod_python/Cookie.py index a22d6973..52bedc2c 100644 --- a/lib/python/mod_python/Cookie.py +++ b/lib/python/mod_python/Cookie.py @@ -1,6 +1,6 @@ # vim: set sw=4 expandtab : # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/Session.py b/lib/python/mod_python/Session.py index 40b2b53a..8bd56be1 100644 --- a/lib/python/mod_python/Session.py +++ b/lib/python/mod_python/Session.py @@ -1,6 +1,6 @@ # vim: set sw=4 expandtab : # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/__init__.py b/lib/python/mod_python/__init__.py index 4e8a79ed..b1b0191e 100644 --- a/lib/python/mod_python/__init__.py +++ b/lib/python/mod_python/__init__.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -30,5 +30,3 @@ # httpdconf, so we fail silently from . import apache except: pass - - diff --git a/lib/python/mod_python/apache.py b/lib/python/mod_python/apache.py index 53333db8..5ac484e7 100644 --- a/lib/python/mod_python/apache.py +++ b/lib/python/mod_python/apache.py @@ -1,6 +1,6 @@ # vim: set sw=4 expandtab : # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/cache.py b/lib/python/mod_python/cache.py index f957c2f2..edce1eca 100644 --- a/lib/python/mod_python/cache.py +++ b/lib/python/mod_python/cache.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -280,7 +280,7 @@ def build(self, key, name, opened, entry): def parseRFC822Time(t): return mktime(parsedate(t)) -re_max_age=re.compile('max-age\s*=\s*(\d+)', re.I) +re_max_age=re.compile(r'max-age\s*=\s*(\d+)', re.I) class HTTPEntity(object): def __init__(self, entity, metadata): diff --git a/lib/python/mod_python/cgihandler.py b/lib/python/mod_python/cgihandler.py index a46a3461..210f6284 100644 --- a/lib/python/mod_python/cgihandler.py +++ b/lib/python/mod_python/cgihandler.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -18,9 +18,14 @@ # from . import apache -import imp import os import sys +PY2 = sys.version[0] == '2' + +if PY2 or sys.hexversion < 0x030c0000: # 3.12.0 + import imp +else: + import importlib.util # if threads are not available # create a functionless lock object @@ -86,24 +91,53 @@ def handler(req): # simulate cgi environment env, si, so = apache.setup_cgi(req) - try: - # we do not search the pythonpath (security reasons) - fd, path, desc = imp.find_module(module_name, [dir]) - except ImportError: + scriptPath = os.path.join(dir, file) + + if not os.path.exists(scriptPath): + raise apache.SERVER_RETURN(apache.HTTP_NOT_FOUND) + + # avoid loading modules outside dir + # (e.g. shenanigans like ../../../../etc/passwd) + scriptPath = os.path.abspath(scriptPath) + if not scriptPath.startswith(dir): raise apache.SERVER_RETURN(apache.HTTP_NOT_FOUND) - # this executes the module - imp.load_module(module_name, fd, path, desc) + if PY2 or sys.hexversion < 0x030c0000: # 3.12.0 + + try: + # we do not search the pythonpath (security reasons) + fd, path, desc = imp.find_module(module_name, [dir]) + except ImportError: + raise apache.SERVER_RETURN(apache.HTTP_NOT_FOUND) + + # this executes the module + imp.load_module(module_name, fd, path, desc) + + else: + + try: + # we do not search the pythonpath (security reasons) + spec = importlib.util.spec_from_file_location(module_name, scriptPath) + except (ModuleNotFoundError, ValueError): + raise apache.SERVER_RETURN(apache.HTTP_NOT_FOUND) + + if spec is None: + raise apache.SERVER_RETURN(apache.HTTP_NOT_FOUND) + + module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module + spec.loader.exec_module(module) return apache.OK finally: # unsimulate the cgi environment apache.restore_nocgi(env, si, so) - try: - fd.close() - except: pass + if PY2: + try: + fd.close() + except: pass os.chdir(cwd) + finally: _lock.release() - diff --git a/lib/python/mod_python/httpdconf.py b/lib/python/mod_python/httpdconf.py index c5970bba..3c0ee877 100644 --- a/lib/python/mod_python/httpdconf.py +++ b/lib/python/mod_python/httpdconf.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/psp.py b/lib/python/mod_python/psp.py index 398ded64..4892540f 100644 --- a/lib/python/mod_python/psp.py +++ b/lib/python/mod_python/psp.py @@ -1,6 +1,6 @@ # vim: set sw=4 expandtab : # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -475,4 +475,3 @@ def get(self, filename, mtime): return None mem_fcache = FileCache() - diff --git a/lib/python/mod_python/publisher.py b/lib/python/mod_python/publisher.py index 5882e771..ecc7c79b 100644 --- a/lib/python/mod_python/publisher.py +++ b/lib/python/mod_python/publisher.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -34,7 +34,6 @@ import sys import os from os.path import exists, isabs, normpath, split, isfile, join, dirname -import imp import re import base64 @@ -43,8 +42,6 @@ import collections -imp_suffixes = " ".join([x[0][1:] for x in imp.get_suffixes()]) - # Python 2/3 compat workaround PY2 = sys.version[0] == '2' def _callable(obj): @@ -258,10 +255,19 @@ def lookup(name): if name in names: i = list(names).index(name) if i is not None: - if PY2: - return (1, func_code.co_consts[i+1]) + # Python 3.11 moved qualified name into code object + # https://github.com/python/cpython/pull/26941 + # commit 2f180ce2cb6e6a7e3c517495e0f4873d6aaf5f2f + if PY2 or sys.hexversion >= 0x030b0000: + # Python 3.14 added CO_HAS_DOCSTRING (0x4000000) + # https://github.com/python/cpython/issues/126072 + # https://github.com/python/cpython/pull/126101 + # commit 35df4eb959b3923c08aaaeff728c5ed1706f31cf + offset = 1 if sys.hexversion < 0x030e0000 or (func_code.co_flags & 0x4000000) != 0 else 0 + return (1, func_code.co_consts[offset+i]) else: return (1, func_code.co_consts[1+i*2]) + return (0, None) (found_auth, __auth__) = lookup('__auth__') @@ -299,7 +305,7 @@ def lookup(name): s = base64.decodestring(s) else: s = req.headers_in["Authorization"][6:].encode() - s = base64.decodestring(s).decode() + s = base64.decodebytes(s).decode() user, passwd = s.split(":", 1) except: raise apache.SERVER_RETURN(apache.HTTP_BAD_REQUEST) diff --git a/lib/python/mod_python/python22.py b/lib/python/mod_python/python22.py index 544517c7..1d0f1cb0 100644 --- a/lib/python/mod_python/python22.py +++ b/lib/python/mod_python/python22.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -22,6 +22,6 @@ import sys if sys.version < '2.3': import builtins as hack - + # Enumerate does not exists in Python 2.2 hack.enumerate = lambda s : list(zip(list(range(len(s))),s)) diff --git a/lib/python/mod_python/testhandler.py b/lib/python/mod_python/testhandler.py index 3985ee64..9b2092d2 100644 --- a/lib/python/mod_python/testhandler.py +++ b/lib/python/mod_python/testhandler.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/util.py b/lib/python/mod_python/util.py index 30601a54..698762f4 100644 --- a/lib/python/mod_python/util.py +++ b/lib/python/mod_python/util.py @@ -1,6 +1,6 @@ # vim: set sw=4 expandtab : # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/lib/python/mod_python/wsgi.py b/lib/python/mod_python/wsgi.py index dbd66084..64c288df 100644 --- a/lib/python/mod_python/wsgi.py +++ b/lib/python/mod_python/wsgi.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -76,5 +76,3 @@ def handler(req): getattr(response, 'close', lambda: None)() return apache.OK - - diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 726bc719..52f98d35 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -1,4 +1,4 @@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/scripts/mod_python.in b/scripts/mod_python.in index b242c1ff..17e96160 100644 --- a/scripts/mod_python.in +++ b/scripts/mod_python.in @@ -1,6 +1,6 @@ #!@PYTHON_BIN@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -64,7 +64,9 @@ def cmd_genconfig(): if len(args) != 1: parser.error("Must specify ") - execfile(args[0]) + src = args[0] + with open(src, "rb") as fh: + exec(compile(fh.read(), src, "exec")) def cmd_create(): @@ -163,5 +165,3 @@ if __name__ == "__main__": ### Local Variables: ### mode:python ### End: - - diff --git a/src/Makefile.in b/src/Makefile.in index c32fac5f..be840314 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,4 +1,4 @@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/_apachemodule.c b/src/_apachemodule.c index 7fd2b34a..976e8da5 100644 --- a/src/_apachemodule.c +++ b/src/_apachemodule.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -370,6 +370,10 @@ static PyObject *parse_qsl(PyObject *self, PyObject *args) _PyBytes_Resize(&val, strlen(cval)); if (key && val) { + + ckey = PyBytes_AS_STRING(key); + cval = PyBytes_AS_STRING(val); + PyObject *listitem = NULL; if (unicode) { PyObject *ukey, *uval; @@ -852,13 +856,6 @@ PyObject *_apache_module_init() m = Py_InitModule("_apache", _apache_module_methods); #else m = PyModule_Create(&_apache_moduledef); - PyObject *name = PyUnicode_FromString("_apache"); - - _PyImport_FixupExtensionObject(m, name, name -#if PY_MINOR_VERSION >= 7 - ,PyImport_GetModuleDict() -#endif - ); #endif d = PyModule_GetDict(m); Mp_ServerReturn = PyErr_NewException("_apache.SERVER_RETURN", NULL, NULL); diff --git a/src/_pspmodule.c b/src/_pspmodule.c index 00213cc9..3d1cb210 100644 --- a/src/_pspmodule.c +++ b/src/_pspmodule.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -28,9 +28,6 @@ #include "_pspmodule.h" #include "Python.h" -/* calm down compile warning from psp_flex.h*/ -static int yy_init_globals (yyscan_t yyscanner ) {return 0;}; - static psp_parser_t *psp_parser_init(void) { psp_parser_t *parser; @@ -134,7 +131,6 @@ static PyObject * _psp_module_parsestring(PyObject *self, PyObject *argv) char *c_str = NULL; yyscan_t scanner; psp_parser_t *parser; - YY_BUFFER_STATE bs; if (!PyArg_ParseTuple(argv, "S", &str)) { return NULL; @@ -154,7 +150,7 @@ static PyObject * _psp_module_parsestring(PyObject *self, PyObject *argv) if (!c_str) c_str = "UNICODE ERROR"; - bs = yy_scan_string(c_str, scanner); + yy_scan_string(c_str, scanner); yylex(scanner); Py_XDECREF(latin); diff --git a/src/connobject.c b/src/connobject.c index 82cf195e..1ac66780 100644 --- a/src/connobject.c +++ b/src/connobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -279,6 +279,7 @@ static PyMemberDef conn_memberlist[] = { {"remote_ip", T_STRING, OFF(client_ip), READONLY}, /* bw compat */ #else {"remote_addr", T_OBJECT, 0, READONLY}, + {"client_ip", T_STRING, OFF(remote_ip), READONLY}, {"remote_ip", T_STRING, OFF(remote_ip), READONLY}, #endif {"remote_host", T_STRING, OFF(remote_host), READONLY}, @@ -461,5 +462,3 @@ PyTypeObject MpConn_Type = { 0, /* tp_as_mapping*/ 0, /* tp_hash*/ }; - - diff --git a/src/filterobject.c b/src/filterobject.c index 712dbb4f..1e142174 100644 --- a/src/filterobject.c +++ b/src/filterobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -569,4 +569,3 @@ PyTypeObject MpFilter_Type = { 0, /* tp_as_mapping*/ 0, /* tp_hash*/ }; - diff --git a/src/finfoobject.c b/src/finfoobject.c index cf3b226e..1912ded2 100644 --- a/src/finfoobject.c +++ b/src/finfoobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/hlist.c b/src/hlist.c index cae10e72..547a1889 100644 --- a/src/hlist.c +++ b/src/hlist.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -148,4 +148,3 @@ void hlist_extend(apr_pool_t *p, hl_entry *hle1, hle2 = hle2->next; } } - diff --git a/src/hlistobject.c b/src/hlistobject.c index ede227a2..619cb3b9 100644 --- a/src/hlistobject.c +++ b/src/hlistobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -179,5 +179,3 @@ PyTypeObject MpHList_Type = { 0, /* tp_as_mapping*/ 0, /* tp_hash*/ }; - - diff --git a/src/include/_apachemodule.h b/src/include/_apachemodule.h index 061df3e8..35ee6754 100644 --- a/src/include/_apachemodule.h +++ b/src/include/_apachemodule.h @@ -2,7 +2,7 @@ #define Mp_APACHEMODULE_H /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -29,6 +29,5 @@ */ PyObject *get_ServerReturn(void); -PyMODINIT_FUNC init_apache(void); #endif /* !Mp_APACHEMODULE_H */ diff --git a/src/include/_pspmodule.h b/src/include/_pspmodule.h index 4fdc0227..ce3d6c7e 100644 --- a/src/include/_pspmodule.h +++ b/src/include/_pspmodule.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -31,4 +31,3 @@ #endif #endif /* __PSP_MODULE_H */ - diff --git a/src/include/connobject.h b/src/include/connobject.h index a4f2fc63..87683508 100644 --- a/src/include/connobject.h +++ b/src/include/connobject.h @@ -5,7 +5,7 @@ extern "C" { #endif /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/filterobject.h b/src/include/filterobject.h index b8151efb..e558e13e 100644 --- a/src/include/filterobject.h +++ b/src/include/filterobject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/finfoobject.h b/src/include/finfoobject.h index c052d598..0671c1f9 100644 --- a/src/include/finfoobject.h +++ b/src/include/finfoobject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/hlist.h b/src/include/hlist.h index 2666bfca..3a367a91 100644 --- a/src/include/hlist.h +++ b/src/include/hlist.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -17,10 +17,10 @@ * Originally developed by Gregory Trubetskoy. * * - * hlist.h + * hlist.h * * - * See accompanying documentation and source code comments + * See accompanying documentation and source code comments * for details. * */ @@ -43,9 +43,9 @@ extern "C" { no error should be reported */ struct hl_entry *next; } hl_entry; - - hl_entry *hlist_new(apr_pool_t *p, const char *h, const char *d, - char d_is_fnmatch, char d_is_location, + + hl_entry *hlist_new(apr_pool_t *p, const char *h, const char *d, + char d_is_fnmatch, char d_is_location, ap_regex_t *regex, const char silent); hl_entry *hlist_append(apr_pool_t *p, hl_entry *hle, const char * h, const char *d, char d_is_fnmatch, char d_is_location, diff --git a/src/include/hlistobject.h b/src/include/hlistobject.h index aebbfdfc..fdb5bd4d 100644 --- a/src/include/hlistobject.h +++ b/src/include/hlistobject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/mod_python.h b/src/include/mod_python.h index 69f02146..27d8aca1 100644 --- a/src/include/mod_python.h +++ b/src/include/mod_python.h @@ -2,7 +2,7 @@ #define Mp_MOD_PYTHON_H /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -22,8 +22,6 @@ * * mod_python.h * - * $Id: mod_python.h 231054 2005-08-09 15:37:04Z jgallacher $ - * * See accompanying documentation and source code comments * for details. * diff --git a/src/include/mod_python.h.in b/src/include/mod_python.h.in index 8d97c475..688ea72a 100644 --- a/src/include/mod_python.h.in +++ b/src/include/mod_python.h.in @@ -2,7 +2,7 @@ #define Mp_MOD_PYTHON_H /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/psp_flex.h b/src/include/psp_flex.h index 888440f4..9817f1e9 100644 --- a/src/include/psp_flex.h +++ b/src/include/psp_flex.h @@ -12,8 +12,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -58,7 +58,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -89,27 +88,23 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) +#endif /* ! C99 */ -#define YY_USE_CONST +#endif /* ! FLEXINT_H */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* An opaque pointer. */ @@ -131,7 +126,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE @@ -156,7 +159,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -184,7 +187,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -195,25 +198,25 @@ struct yy_buffer_state }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void yypop_buffer_state (yyscan_t yyscanner ); +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void yyfree (void * ,yyscan_t yyscanner ); +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -242,36 +245,40 @@ void yyfree (void * ,yyscan_t yyscanner ); int yylex_init (yyscan_t* scanner); -int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (yyscan_t yyscanner ); +int yylex_destroy ( yyscan_t yyscanner ); -int yyget_debug (yyscan_t yyscanner ); +int yyget_debug ( yyscan_t yyscanner ); -void yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); -void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -FILE *yyget_in (yyscan_t yyscanner ); +FILE *yyget_in ( yyscan_t yyscanner ); -void yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *yyget_out (yyscan_t yyscanner ); +FILE *yyget_out ( yyscan_t yyscanner ); -void yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -int yyget_leng (yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); -char *yyget_text (yyscan_t yyscanner ); +char *yyget_text ( yyscan_t yyscanner ); -int yyget_lineno (yyscan_t yyscanner ); +int yyget_lineno ( yyscan_t yyscanner ); -void yyset_lineno (int line_number ,yyscan_t yyscanner ); +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); + +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -279,18 +286,18 @@ void yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (yyscan_t yyscanner ); +extern "C" int yywrap ( yyscan_t yyscanner ); #else -extern int yywrap (yyscan_t yyscanner ); +extern int yywrap ( yyscan_t yyscanner ); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT @@ -299,7 +306,12 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Number of entries by which start-condition stack grows. */ @@ -332,9 +344,154 @@ extern int yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#line 239 "psp_parser.l" +#ifndef yy_create_buffer_ALREADY_DEFINED +#undef yy_create_buffer +#endif +#ifndef yy_delete_buffer_ALREADY_DEFINED +#undef yy_delete_buffer +#endif +#ifndef yy_scan_buffer_ALREADY_DEFINED +#undef yy_scan_buffer +#endif +#ifndef yy_scan_string_ALREADY_DEFINED +#undef yy_scan_string +#endif +#ifndef yy_scan_bytes_ALREADY_DEFINED +#undef yy_scan_bytes +#endif +#ifndef yy_init_buffer_ALREADY_DEFINED +#undef yy_init_buffer +#endif +#ifndef yy_flush_buffer_ALREADY_DEFINED +#undef yy_flush_buffer +#endif +#ifndef yy_load_buffer_state_ALREADY_DEFINED +#undef yy_load_buffer_state +#endif +#ifndef yy_switch_to_buffer_ALREADY_DEFINED +#undef yy_switch_to_buffer +#endif +#ifndef yypush_buffer_state_ALREADY_DEFINED +#undef yypush_buffer_state +#endif +#ifndef yypop_buffer_state_ALREADY_DEFINED +#undef yypop_buffer_state +#endif +#ifndef yyensure_buffer_stack_ALREADY_DEFINED +#undef yyensure_buffer_stack +#endif +#ifndef yylex_ALREADY_DEFINED +#undef yylex +#endif +#ifndef yyrestart_ALREADY_DEFINED +#undef yyrestart +#endif +#ifndef yylex_init_ALREADY_DEFINED +#undef yylex_init +#endif +#ifndef yylex_init_extra_ALREADY_DEFINED +#undef yylex_init_extra +#endif +#ifndef yylex_destroy_ALREADY_DEFINED +#undef yylex_destroy +#endif +#ifndef yyget_debug_ALREADY_DEFINED +#undef yyget_debug +#endif +#ifndef yyset_debug_ALREADY_DEFINED +#undef yyset_debug +#endif +#ifndef yyget_extra_ALREADY_DEFINED +#undef yyget_extra +#endif +#ifndef yyset_extra_ALREADY_DEFINED +#undef yyset_extra +#endif +#ifndef yyget_in_ALREADY_DEFINED +#undef yyget_in +#endif +#ifndef yyset_in_ALREADY_DEFINED +#undef yyset_in +#endif +#ifndef yyget_out_ALREADY_DEFINED +#undef yyget_out +#endif +#ifndef yyset_out_ALREADY_DEFINED +#undef yyset_out +#endif +#ifndef yyget_leng_ALREADY_DEFINED +#undef yyget_leng +#endif +#ifndef yyget_text_ALREADY_DEFINED +#undef yyget_text +#endif +#ifndef yyget_lineno_ALREADY_DEFINED +#undef yyget_lineno +#endif +#ifndef yyset_lineno_ALREADY_DEFINED +#undef yyset_lineno +#endif +#ifndef yyget_column_ALREADY_DEFINED +#undef yyget_column +#endif +#ifndef yyset_column_ALREADY_DEFINED +#undef yyset_column +#endif +#ifndef yywrap_ALREADY_DEFINED +#undef yywrap +#endif +#ifndef yyget_lval_ALREADY_DEFINED +#undef yyget_lval +#endif +#ifndef yyset_lval_ALREADY_DEFINED +#undef yyset_lval +#endif +#ifndef yyget_lloc_ALREADY_DEFINED +#undef yyget_lloc +#endif +#ifndef yyset_lloc_ALREADY_DEFINED +#undef yyset_lloc +#endif +#ifndef yyalloc_ALREADY_DEFINED +#undef yyalloc +#endif +#ifndef yyrealloc_ALREADY_DEFINED +#undef yyrealloc +#endif +#ifndef yyfree_ALREADY_DEFINED +#undef yyfree +#endif +#ifndef yytext_ALREADY_DEFINED +#undef yytext +#endif +#ifndef yyleng_ALREADY_DEFINED +#undef yyleng +#endif +#ifndef yyin_ALREADY_DEFINED +#undef yyin +#endif +#ifndef yyout_ALREADY_DEFINED +#undef yyout +#endif +#ifndef yy_flex_debug_ALREADY_DEFINED +#undef yy_flex_debug +#endif +#ifndef yylineno_ALREADY_DEFINED +#undef yylineno +#endif +#ifndef yytables_fload_ALREADY_DEFINED +#undef yytables_fload +#endif +#ifndef yytables_destroy_ALREADY_DEFINED +#undef yytables_destroy +#endif +#ifndef yyTABLES_NAME_ALREADY_DEFINED +#undef yyTABLES_NAME +#endif + +#line 240 "psp_parser.l" -#line 339 "include/psp_flex.h" +#line 496 "include/psp_flex.h" #undef yyIN_HEADER #endif /* yyHEADER_H */ diff --git a/src/include/psp_parser.h b/src/include/psp_parser.h index d1b1b883..6ab4b1e3 100644 --- a/src/include/psp_parser.h +++ b/src/include/psp_parser.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/psp_string.h b/src/include/psp_string.h index e925ca61..e68cae43 100644 --- a/src/include/psp_string.h +++ b/src/include/psp_string.h @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -41,4 +41,3 @@ void psp_string_clear(psp_string *); void psp_string_free(psp_string *); #endif /* __PSP_STRING_H */ - diff --git a/src/include/requestobject.h b/src/include/requestobject.h index b6aee687..0d2d6a38 100644 --- a/src/include/requestobject.h +++ b/src/include/requestobject.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/serverobject.h b/src/include/serverobject.h index b034e08a..43b93bae 100644 --- a/src/include/serverobject.h +++ b/src/include/serverobject.h @@ -5,7 +5,7 @@ extern "C" { #endif /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/tableobject.h b/src/include/tableobject.h index e0680cc7..789c51bf 100644 --- a/src/include/tableobject.h +++ b/src/include/tableobject.h @@ -5,7 +5,7 @@ extern "C" { #endif /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/src/include/util.h b/src/include/util.h index 495d7245..153bff95 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -2,9 +2,9 @@ #define Mp_UTIL_H /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -20,10 +20,10 @@ * Originally developed by Gregory Trubetskoy. * * - * util.h + * util.h * * - * See accompanying documentation and source code comments + * See accompanying documentation and source code comments * for details. * */ diff --git a/src/mod_python.c b/src/mod_python.c index 11af968c..b79a5a6a 100644 --- a/src/mod_python.c +++ b/src/mod_python.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -69,12 +69,6 @@ static PyObject * make_obcallback(const char *name) PyObject *m = NULL; PyObject *obCallBack = NULL; - /* This makes _apache appear imported, and subsequent - * >>> import _apache - * will not give an error. - */ - _apache_module_init(); - /* Now execute the equivalent of * >>> import * >>> @@ -303,7 +297,7 @@ static void release_interpreter(interpreterdata *idata) { PyThreadState *tstate = PyThreadState_Get(); #ifdef WITH_THREAD -#if PY_MAJOR_VERSION <= 3 && PY_MINOR_VERSION < 10 +#if PY_MAJOR_VERSION <= 3 && PY_MINOR_VERSION < 9 PyThreadState_Clear(tstate); #endif if (idata) @@ -710,7 +704,6 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, const char *userdata_key = "python_init"; apr_status_t rc; - const char *py_compile_version = PY_VERSION; const char *py_dynamic_version = 0; /* The "initialized" flag is a fudge for Mac OS X. It @@ -752,19 +745,7 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, /* mod_python version */ ap_add_version_component(p, mp_version_component); - py_dynamic_version = strtok((char *)Py_GetVersion(), " "); - - if (strcmp(py_compile_version, py_dynamic_version) != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, - "python_init: Python version mismatch, expected '%s', found '%s'.", - py_compile_version, py_dynamic_version); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, - "python_init: Python executable found '" PRIs "'.", - Py_GetProgramFullPath()); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, - "python_init: Python path being used '" PRIs "'.", - Py_GetPath()); - } + py_dynamic_version = strtok(apr_pstrdup(p, Py_GetVersion()), " "); /* Python version */ sprintf(buff, "Python/%.200s", py_dynamic_version); @@ -783,10 +764,10 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, if (initialized == 0 || !Py_IsInitialized()) { initialized = 1; - +#if PY_VERSION_HEX < 0x030C0000 /* disable user site directories */ Py_NoUserSiteDirectory = 1; - +#endif /* Initialze the main interpreter. */ #if PY_MAJOR_VERSION == 2 && \ (PY_MINOR_VERSION < 7 || (PY_MINOR_VERSION == 7 && PY_MICRO_VERSION < 14)) @@ -800,6 +781,14 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, Py_NoSiteFlag = 1; #endif +#if PY_MAJOR_VERSION == 2 + PyMODINIT_FUNC init_apache(void); + PyImport_AppendInittab("_apache", &init_apache); +#else + PyMODINIT_FUNC PyInit_apache(void); + PyImport_AppendInittab("_apache", &PyInit_apache); +#endif + Py_Initialize(); #if PY_MAJOR_VERSION == 2 && \ @@ -807,7 +796,8 @@ static int python_init(apr_pool_t *p, apr_pool_t *ptemp, Py_NoSiteFlag = 0; #endif -#ifdef WITH_THREAD + /* see https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads */ +#if defined (WITH_THREAD) && PY_VERSION_HEX < 0x03070000 /* create and acquire the interpreter lock */ PyEval_InitThreads(); #endif @@ -1977,6 +1967,25 @@ static apr_status_t handle_python(include_ctx_t *ctx, return APR_SUCCESS; } + /* get configuration */ + conf = (py_config *) ap_get_module_config(req->per_dir_config, + &python_module); + + /* determine interpreter to use */ + interp_name = select_interp_name(req, NULL, conf, NULL, NULL); + + /* get/create interpreter */ + idata = get_interpreter(interp_name); + + if (!idata) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req, + "handle_python: Can't get/create interpreter."); + + Py_XDECREF(tagobject); + Py_XDECREF(codeobject); + return HTTP_INTERNAL_SERVER_ERROR; + } + /* process tags */ while (1) { optfn_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); @@ -2030,25 +2039,6 @@ static apr_status_t handle_python(include_ctx_t *ctx, return APR_SUCCESS; } - /* get configuration */ - conf = (py_config *) ap_get_module_config(req->per_dir_config, - &python_module); - - /* determine interpreter to use */ - interp_name = select_interp_name(req, NULL, conf, NULL, NULL); - - /* get/create interpreter */ - idata = get_interpreter(interp_name); - - if (!idata) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req, - "handle_python: Can't get/create interpreter."); - - Py_XDECREF(tagobject); - Py_XDECREF(codeobject); - return HTTP_INTERNAL_SERVER_ERROR; - } - /* create/acquire request object */ request_obj = python_get_request_object(req, 0); @@ -2423,8 +2413,10 @@ static const char *directive_PythonOption(cmd_parms *cmd, void * mconfig, static const char *directive_PythonOptimize(cmd_parms *cmd, void *mconfig, int val) { +#if PY_VERSION_HEX < 0x030C0000 if ((val) && (Py_OptimizeFlag != 2)) Py_OptimizeFlag = 2; +#endif return NULL; } @@ -2648,7 +2640,12 @@ static void PythonChildInitHandler(apr_pool_t *p, server_rec *s) /* accordig Py C Docs we must do this after forking */ PyEval_RestoreThread(global_tstate); + +#if PY_VERSION_HEX < 0x03070000 PyOS_AfterFork(); +#elif PY_VERSION_HEX < 0x030D0000 + PyOS_AfterFork_Child(); +#endif interpreterdata *idata = save_interpreter(MAIN_INTERPRETER, PyThreadState_Get()); if (!idata) @@ -2992,11 +2989,3 @@ module python_module = python_commands, /* command table */ python_register_hooks /* register hooks */ }; - - - - - - - - diff --git a/src/psp_parser.c b/src/psp_parser.c index 2f1768cb..d4b2de2a 100644 --- a/src/psp_parser.c +++ b/src/psp_parser.c @@ -8,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -54,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,38 +84,32 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) +#endif /* ! C99 */ -#define YY_USE_CONST +#endif /* ! FLEXINT_H */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -140,25 +133,29 @@ typedef void* yyscan_t; * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) - +#define YY_NEW_FILE yyrestart( yyin , yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -170,11 +167,17 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -189,14 +192,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -209,7 +206,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -237,7 +234,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -271,84 +268,77 @@ struct yy_buffer_state #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void yypop_buffer_state (yyscan_t yyscanner ); +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); -static void yyensure_buffer_stack (yyscan_t yyscanner ); -static void yy_load_buffer_state (yyscan_t yyscanner ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); - -void *yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void yyfree (void * ,yyscan_t yyscanner ); +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); #define yy_new_buffer yy_create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; +typedef flex_uint8_t YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); -static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; - #define YY_NUM_RULES 23 #define YY_END_OF_BUFFER 24 /* This struct is not used in this scanner, @@ -358,7 +348,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[73] = +static const flex_int16_t yy_accept[73] = { 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 24, 2, 1, 2, 11, 10, 11, 11, @@ -370,7 +360,7 @@ static yyconst flex_int16_t yy_accept[73] = 20, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -402,14 +392,14 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[25] = +static const YY_CHAR yy_meta[25] = { 0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[79] = +static const flex_int16_t yy_base[79] = { 0, 0, 2, 4, 16, 28, 35, 6, 43, 4, 5, 81, 80, 87, 90, 90, 83, 90, 90, 82, 77, @@ -421,7 +411,7 @@ static yyconst flex_int16_t yy_base[79] = 11, 90, 57, 59, 61, 63, 65, 0 } ; -static yyconst flex_int16_t yy_def[79] = +static const flex_int16_t yy_def[79] = { 0, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 77, 77, 72, 72, 72, 72, 72, 72, 72, 72, @@ -433,7 +423,7 @@ static yyconst flex_int16_t yy_def[79] = 78, 0, 72, 72, 72, 72, 72, 72 } ; -static yyconst flex_int16_t yy_nxt[115] = +static const flex_int16_t yy_nxt[115] = { 0, 70, 72, 15, 16, 15, 16, 18, 19, 28, 29, 33, 33, 30, 20, 68, 69, 71, 21, 18, 19, @@ -450,7 +440,7 @@ static yyconst flex_int16_t yy_nxt[115] = 72, 72, 72, 72 } ; -static yyconst flex_int16_t yy_chk[115] = +static const flex_int16_t yy_chk[115] = { 0, 78, 0, 1, 1, 2, 2, 3, 3, 7, 7, 9, 10, 7, 3, 67, 67, 71, 3, 4, 4, @@ -477,9 +467,9 @@ static yyconst flex_int16_t yy_chk[115] = #line 1 "psp_parser.l" #line 2 "psp_parser.l" /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -494,7 +484,7 @@ static yyconst flex_int16_t yy_chk[115] = * * * This file originally written by Sterling Hughes. - * + * */ /* NOTE The seemingly unusual generated Python code (sometime using @@ -511,13 +501,10 @@ static yyconst flex_int16_t yy_chk[115] = #define CLEAR_WHITESPACE(__wsstring) psp_string_clear((__wsstring)); +#line 505 "psp_parser.c" #define YY_NO_UNISTD_H 1 - - - - -#line 520 "psp_parser.c" +#line 508 "psp_parser.c" #define INITIAL 0 #define TEXT 1 @@ -572,40 +559,44 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals (yyscan_t yyscanner ); +static int yy_init_globals ( yyscan_t yyscanner ); int yylex_init (yyscan_t* scanner); -int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy (yyscan_t yyscanner ); +int yylex_destroy ( yyscan_t yyscanner ); + +int yyget_debug ( yyscan_t yyscanner ); -int yyget_debug (yyscan_t yyscanner ); +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); -void yyset_debug (int debug_flag ,yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +FILE *yyget_in ( yyscan_t yyscanner ); -FILE *yyget_in (yyscan_t yyscanner ); +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -void yyset_in (FILE * in_str ,yyscan_t yyscanner ); +FILE *yyget_out ( yyscan_t yyscanner ); -FILE *yyget_out (yyscan_t yyscanner ); +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); -int yyget_leng (yyscan_t yyscanner ); +char *yyget_text ( yyscan_t yyscanner ); -char *yyget_text (yyscan_t yyscanner ); +int yyget_lineno ( yyscan_t yyscanner ); -int yyget_lineno (yyscan_t yyscanner ); +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); -void yyset_lineno (int line_number ,yyscan_t yyscanner ); +int yyget_column ( yyscan_t yyscanner ); + +void yyset_column ( int _column_no , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -613,35 +604,43 @@ void yyset_lineno (int line_number ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (yyscan_t yyscanner ); +extern "C" int yywrap ( yyscan_t yyscanner ); #else -extern int yywrap (yyscan_t yyscanner ); +extern int yywrap ( yyscan_t yyscanner ); #endif #endif - static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner); +#endif + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (yyscan_t yyscanner ); +static int yyinput ( yyscan_t yyscanner ); #else -static int input (yyscan_t yyscanner ); +static int input ( yyscan_t yyscanner ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -649,7 +648,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -660,7 +659,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -673,7 +672,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -728,7 +727,7 @@ extern int yylex (yyscan_t yyscanner); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -741,16 +740,11 @@ extern int yylex (yyscan_t yyscanner); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 46 "psp_parser.l" - - -#line 752 "psp_parser.c" - if ( !yyg->yy_init ) { yyg->yy_init = 1; @@ -771,13 +765,19 @@ YY_DECL if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 47 "psp_parser.l" + + +#line 779 "psp_parser.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -794,7 +794,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -804,9 +804,9 @@ YY_DECL { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 90 ); @@ -836,9 +836,9 @@ YY_DECL case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 48 "psp_parser.l" +#line 49 "psp_parser.l" { - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); yyless(0); BEGIN TEXT; @@ -846,9 +846,9 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 55 "psp_parser.l" +#line 56 "psp_parser.l" { - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); yyless(0); BEGIN TEXT; @@ -856,28 +856,28 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 62 "psp_parser.l" +#line 63 "psp_parser.l" { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\\n")); } YY_BREAK case 4: YY_RULE_SETUP -#line 66 "psp_parser.l" +#line 67 "psp_parser.l" { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\\r")); } YY_BREAK case 5: YY_RULE_SETUP -#line 70 "psp_parser.l" +#line 71 "psp_parser.l" { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\\t")); } YY_BREAK case 6: YY_RULE_SETUP -#line 74 "psp_parser.l" +#line 75 "psp_parser.l" { /* expression */ psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\",0); req.write(str(")); PSP_PG(is_psp_echo) = 1; @@ -887,24 +887,24 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 81 "psp_parser.l" +#line 82 "psp_parser.l" { /* python code */ - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\",0);")); - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\",0);")); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); PSP_PG(seen_newline) = 0; BEGIN PYCODE; } YY_BREAK case 8: YY_RULE_SETUP -#line 88 "psp_parser.l" +#line 89 "psp_parser.l" { /* directive */ BEGIN DIR; } YY_BREAK case 9: YY_RULE_SETUP -#line 92 "psp_parser.l" +#line 93 "psp_parser.l" { /* comment */ BEGIN COMMENT; } @@ -912,14 +912,14 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 96 "psp_parser.l" +#line 97 "psp_parser.l" { psp_string_appendc(&PSP_PG(pycode), '\n'); } YY_BREAK case 11: YY_RULE_SETUP -#line 100 "psp_parser.l" +#line 101 "psp_parser.l" { if (yytext[0] == '"') { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\\\"")); @@ -929,7 +929,7 @@ YY_RULE_SETUP } YY_BREAK case YY_STATE_EOF(TEXT): -#line 108 "psp_parser.l" +#line 109 "psp_parser.l" { yypop_buffer_state(yyscanner); if (!YY_CURRENT_BUFFER) { @@ -946,23 +946,23 @@ case YY_STATE_EOF(TEXT): case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 121 "psp_parser.l" +#line 122 "psp_parser.l" { psp_string_appendc(&PSP_PG(pycode), '\n'); - + PSP_PG(seen_newline) = 1; BEGIN INDENT; } YY_BREAK case 13: YY_RULE_SETUP -#line 128 "psp_parser.l" +#line 129 "psp_parser.l" { if (PSP_PG(is_psp_echo)) { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("),0); req.write(\"\"\"")); PSP_PG(is_psp_echo) = 0; - } + } else { if (!PSP_PG(seen_newline)) { /* this will happen is you have <%%> */ @@ -970,7 +970,7 @@ YY_RULE_SETUP } if (PSP_PG(after_colon)) { - /* this is dumb mistake-proof measure, if %> + /* this is dumb mistake-proof measure, if %> is immediately following where there should be an indent */ psp_string_appendc(&PSP_PG(whitespace), '\t'); PSP_PG(after_colon) = 0; @@ -978,13 +978,13 @@ YY_RULE_SETUP OUTPUT_WHITESPACE(&PSP_PG(whitespace)); psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); } - + BEGIN TEXT; } YY_BREAK case 14: YY_RULE_SETUP -#line 153 "psp_parser.l" +#line 154 "psp_parser.l" { psp_string_appendc(&PSP_PG(pycode), yytext[0]); PSP_PG(after_colon) = 1; @@ -992,7 +992,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 158 "psp_parser.l" +#line 159 "psp_parser.l" { psp_string_appendc(&PSP_PG(pycode), yytext[0]); PSP_PG(after_colon) = 0; @@ -1000,10 +1000,10 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 163 "psp_parser.l" +#line 164 "psp_parser.l" { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng); psp_string_appendl(&PSP_PG(pycode), yytext, yyleng); @@ -1012,7 +1012,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 172 "psp_parser.l" +#line 173 "psp_parser.l" { yyless(0); BEGIN PYCODE; @@ -1021,18 +1021,18 @@ YY_RULE_SETUP case 18: /* rule 18 can match eol */ YY_RULE_SETUP -#line 177 "psp_parser.l" +#line 178 "psp_parser.l" { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); yyless(0); BEGIN PYCODE; } YY_BREAK case 19: YY_RULE_SETUP -#line 183 "psp_parser.l" +#line 184 "psp_parser.l" { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); yyless(0); BEGIN PYCODE; } @@ -1040,7 +1040,7 @@ YY_RULE_SETUP case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 189 "psp_parser.l" +#line 190 "psp_parser.l" { char *filename; @@ -1075,7 +1075,8 @@ YY_RULE_SETUP PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); } else { - yypush_buffer_state(yy_create_buffer(f,YY_BUF_SIZE,yyscanner),yyscanner); + yypush_buffer_state(yy_create_buffer(f, YY_BUF_SIZE, yyscanner), + yyscanner); BEGIN(TEXT); } @@ -1084,24 +1085,24 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 231 "psp_parser.l" +#line 232 "psp_parser.l" { BEGIN TEXT; } YY_BREAK case 22: YY_RULE_SETUP -#line 235 "psp_parser.l" +#line 236 "psp_parser.l" { BEGIN TEXT; } YY_BREAK case 23: YY_RULE_SETUP -#line 239 "psp_parser.l" +#line 240 "psp_parser.l" ECHO; YY_BREAK -#line 1104 "psp_parser.c" +#line 1106 "psp_parser.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PYCODE): case YY_STATE_EOF(INDENT): @@ -1183,7 +1184,7 @@ case YY_STATE_EOF(COMMENT): { yyg->yy_did_buffer_switch_on_eof = 0; - if ( yywrap(yyscanner ) ) + if ( yywrap( yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1236,6 +1237,7 @@ case YY_STATE_EOF(COMMENT): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1248,9 +1250,9 @@ case YY_STATE_EOF(COMMENT): static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1279,7 +1281,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1299,7 +1301,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); @@ -1315,11 +1317,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1337,7 +1340,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1347,7 +1350,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); } else @@ -1361,12 +1364,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } yyg->yy_n_chars += number_to_move; @@ -1382,8 +1388,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; @@ -1391,7 +1397,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1401,9 +1407,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1416,11 +1422,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1430,17 +1436,20 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 72); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) { - register char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; @@ -1451,10 +1460,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yyg->yy_n_chars + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1463,7 +1472,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1476,6 +1485,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yyg->yy_c_buf_p = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1501,7 +1512,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -1518,14 +1529,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap(yyscanner ) ) - return EOF; + if ( yywrap( yyscanner ) ) + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -1565,11 +1576,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - yy_load_buffer_state(yyscanner ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); } /** Switch to a different input buffer. @@ -1598,7 +1609,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag @@ -1627,7 +1638,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1636,13 +1647,13 @@ static void yy_load_buffer_state (yyscan_t yyscanner) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer(b,file ,yyscanner); + yy_init_buffer( b, file , yyscanner); return b; } @@ -1662,15 +1673,11 @@ static void yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ,yyscanner ); + yyfree( (void *) b->yy_ch_buf , yyscanner ); - yyfree((void *) b ,yyscanner ); + yyfree( (void *) b , yyscanner ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -1681,7 +1688,7 @@ extern int isatty (int ); int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flush_buffer(b ,yyscanner); + yy_flush_buffer( b , yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1725,7 +1732,7 @@ extern int isatty (int ); b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -1757,7 +1764,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -1771,13 +1778,13 @@ void yypop_buffer_state (yyscan_t yyscanner) if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { - yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -1787,7 +1794,7 @@ void yypop_buffer_state (yyscan_t yyscanner) */ static void yyensure_buffer_stack (yyscan_t yyscanner) { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -1796,15 +1803,15 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; @@ -1813,7 +1820,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc @@ -1833,7 +1840,7 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { @@ -1843,23 +1850,23 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer(b ,yyscanner ); + yy_switch_to_buffer( b , yyscanner ); return b; } @@ -1872,20 +1879,20 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) { - return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -1893,8 +1900,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yysc int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ,yyscanner ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n , yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); @@ -1903,7 +1910,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yysc buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer(buf,n ,yyscanner); + b = yy_scan_buffer( buf, n , yyscanner); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1919,9 +1926,11 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yysc #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1959,7 +1968,7 @@ YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) int yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -1972,7 +1981,7 @@ int yyget_lineno (yyscan_t yyscanner) int yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -2027,51 +2036,51 @@ void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void yyset_lineno (int line_number , yyscan_t yyscanner) +void yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void yyset_column (int column_no , yyscan_t yyscanner) +void yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see yy_switch_to_buffer */ -void yyset_in (FILE * in_str , yyscan_t yyscanner) +void yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void yyset_out (FILE * out_str , yyscan_t yyscanner) +void yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int yyget_debug (yyscan_t yyscanner) @@ -2080,10 +2089,10 @@ int yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void yyset_debug (int bdebug , yyscan_t yyscanner) +void yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2094,9 +2103,7 @@ void yyset_debug (int bdebug , yyscan_t yyscanner) * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ - int yylex_init(yyscan_t* ptr_yy_globals) - { if (ptr_yy_globals == NULL){ errno = EINVAL; @@ -2123,9 +2130,7 @@ int yylex_init(yyscan_t* ptr_yy_globals) * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ - -int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) - +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; @@ -2135,20 +2140,20 @@ int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) errno = EINVAL; return 1; } - + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - + if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } - + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - + yyset_extra (yy_user_defined, *ptr_yy_globals); - + return yy_init_globals ( *ptr_yy_globals ); } @@ -2159,10 +2164,10 @@ static int yy_init_globals (yyscan_t yyscanner) * This function is called from yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2175,8 +2180,8 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2192,17 +2197,17 @@ int yylex_destroy (yyscan_t yyscanner) /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - yyfree(yyg->yy_buffer_stack ,yyscanner); + yyfree(yyg->yy_buffer_stack , yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - yyfree(yyg->yy_start_stack ,yyscanner ); + yyfree( yyg->yy_start_stack , yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time @@ -2220,18 +2225,21 @@ int yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2241,11 +2249,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *yyalloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2253,18 +2266,19 @@ void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void yyfree (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 239 "psp_parser.l" - +#line 240 "psp_parser.l" /* this is for emacs diff --git a/src/psp_parser.l b/src/psp_parser.l index aeaf4d3f..be51c473 100644 --- a/src/psp_parser.l +++ b/src/psp_parser.l @@ -1,8 +1,8 @@ %{ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -17,7 +17,7 @@ * * * This file originally written by Sterling Hughes. - * + * */ /* NOTE The seemingly unusual generated Python code (sometime using @@ -47,14 +47,14 @@ %% \r\n|\n { - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); yyless(0); BEGIN TEXT; } . { - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); yyless(0); BEGIN TEXT; @@ -80,8 +80,8 @@ } "<%" { /* python code */ - psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\",0);")); - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + psp_string_appendl(&PSP_PG(pycode), STATIC_STR("\"\"\",0);")); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); PSP_PG(seen_newline) = 0; BEGIN PYCODE; } @@ -121,7 +121,7 @@ \r\n|\n|\r { psp_string_appendc(&PSP_PG(pycode), '\n'); - + PSP_PG(seen_newline) = 1; BEGIN INDENT; } @@ -131,7 +131,7 @@ if (PSP_PG(is_psp_echo)) { psp_string_appendl(&PSP_PG(pycode), STATIC_STR("),0); req.write(\"\"\"")); PSP_PG(is_psp_echo) = 0; - } + } else { if (!PSP_PG(seen_newline)) { /* this will happen is you have <%%> */ @@ -139,7 +139,7 @@ } if (PSP_PG(after_colon)) { - /* this is dumb mistake-proof measure, if %> + /* this is dumb mistake-proof measure, if %> is immediately following where there should be an indent */ psp_string_appendc(&PSP_PG(whitespace), '\t'); PSP_PG(after_colon) = 0; @@ -147,7 +147,7 @@ OUTPUT_WHITESPACE(&PSP_PG(whitespace)); psp_string_appendl(&PSP_PG(pycode), STATIC_STR("req.write(\"\"\"")); } - + BEGIN TEXT; } @@ -163,7 +163,7 @@ ^[\t ]* { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); psp_string_appendl(&PSP_PG(whitespace), yytext, yyleng); psp_string_appendl(&PSP_PG(pycode), yytext, yyleng); @@ -176,13 +176,13 @@ } \r\n|\n { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); yyless(0); BEGIN PYCODE; } . { - CLEAR_WHITESPACE(&PSP_PG(whitespace)); + CLEAR_WHITESPACE(&PSP_PG(whitespace)); yyless(0); BEGIN PYCODE; } @@ -221,7 +221,7 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); } else { - yypush_buffer_state(yy_create_buffer(f, YY_BUF_SIZE, yyscanner), + yypush_buffer_state(yy_create_buffer(f, YY_BUF_SIZE, yyscanner), yyscanner); BEGIN(TEXT); } diff --git a/src/psp_string.c b/src/psp_string.c index 76815f54..0f7a3ba7 100644 --- a/src/psp_string.c +++ b/src/psp_string.c @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at @@ -18,7 +18,7 @@ * * * - * See accompanying documentation and source code comments + * See accompanying documentation and source code comments * for details. * */ @@ -26,12 +26,12 @@ #include "psp_string.h" #define psp_string_alloc(__pspstring, __length) \ - if ((__length) > (__pspstring)->allocated) { \ + if ((size_t)(__length) > (__pspstring)->allocated) { \ (__pspstring)->blob = realloc((__pspstring)->blob, (__length) + PSP_STRING_BLOCK); \ (__pspstring)->allocated = (__length) + PSP_STRING_BLOCK; \ } -void +void psp_string_0(psp_string *s) { if (!s->length) { @@ -49,7 +49,7 @@ psp_string_appendl(psp_string *s, char *text, size_t length) if (text == NULL) { return; } - + psp_string_alloc(s, newlen); memcpy(s->blob + s->length, text, length); s->length = newlen; @@ -64,17 +64,17 @@ psp_string_append(psp_string *s, char *text) psp_string_appendl(s, text, strlen(text)); } -void +void psp_string_appendc(psp_string *s, char c) { int newlen = s->length + 1; - + psp_string_alloc(s, newlen); s->blob[s->length] = c; s->length = newlen; } -void +void psp_string_clear(psp_string *s) { memset(s->blob, 0, s->length); @@ -88,4 +88,4 @@ psp_string_free(psp_string *s) s->blob = NULL; s->length = 0; s->allocated = 0; -} +} diff --git a/src/requestobject.c b/src/requestobject.c index 38b71653..22d98274 100644 --- a/src/requestobject.c +++ b/src/requestobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -2424,9 +2424,3 @@ PyTypeObject MpRequest_Type = { 0, /* tp_new */ 0, /* tp_free */ }; - - - - - - diff --git a/src/serverobject.c b/src/serverobject.c index d540988a..7af6cb0d 100644 --- a/src/serverobject.c +++ b/src/serverobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -415,8 +415,3 @@ PyTypeObject MpServer_Type = { 0, /* tp_new */ server_dealloc, /* tp_free */ }; - - - - - diff --git a/src/tableobject.c b/src/tableobject.c index 49ce4b99..6d317085 100644 --- a/src/tableobject.c +++ b/src/tableobject.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you @@ -1158,7 +1158,7 @@ static int table_init(tableobject *self, PyObject *args, PyObject *kwds) return result; } -static long table_nohash(PyObject *self) +static Py_hash_t table_nohash(PyObject *self) { TABLE_DEBUG("table_nohash"); @@ -1369,5 +1369,3 @@ PyTypeObject MpTableIter_Type = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ }; - - diff --git a/src/util.c b/src/util.c index 99e73a23..4b32f0d0 100644 --- a/src/util.c +++ b/src/util.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + * Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); you diff --git a/test/Makefile.in b/test/Makefile.in index 9d51e53c..4e8e8f09 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,4 +1,4 @@ - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,11 +20,11 @@ test: $(PYTHON_BIN) test.py clean: - rm -f *.pyc *.pyo + rm -f *.pyc *.pyo cd conf && rm -f test.conf cd htdocs && rm -f *pyc *pyo rm -rf logs rm -rf tmp distclean: clean - rm -f Makefile testconf.py + rm -f Makefile testconf.py diff --git a/test/htdocs/tests.py b/test/htdocs/tests.py index c44d61d8..40f437db 100644 --- a/test/htdocs/tests.py +++ b/test/htdocs/tests.py @@ -682,10 +682,10 @@ def test_req_add_handler_directory(req): if req.phase == "PythonFixupHandler": req.add_handler("PythonHandler", "tests::test_req_add_handler_directory", dir1) else: - # dir2 should only use forward slashes and - # should have a trailing forward slash added by - # call to req.add_handler(). When dir1 and dir2 - # are normalised for current operating system, + # dir2 should only use forward slashes and + # should have a trailing forward slash added by + # call to req.add_handler(). When dir1 and dir2 + # are normalised for current operating system, # they should be equivalent. dir2 = req.hlist.directory if dir2[-1] != '/' or dir2.count('\\') != 0: @@ -703,7 +703,7 @@ def test_req_add_handler_directory(req): def req_allow_methods(req): - req.allow_methods(["PYTHONIZE"]) + req.allow_methods(["MKWORKSPACE"]) return apache.HTTP_METHOD_NOT_ALLOWED def req_get_basic_auth_pw(req): @@ -1500,9 +1500,9 @@ def __getitem__(self, key): log(" table.setdefault()") d = apache.table() d.setdefault('key0') - if d.setdefault('key0') is not "": + if d.setdefault('key0') != "": raise TestFailed('missing {} setdefault, no 2nd arg') - if d.setdefault('key0') is not "": + if d.setdefault('key0') != "": raise TestFailed('present {} setdefault, no 2nd arg') # dict.popitem() log(" table.popitem()") diff --git a/test/test.py b/test/test.py index 0739a89b..73544da2 100644 --- a/test/test.py +++ b/test/test.py @@ -1,5 +1,5 @@ # - # Copyright (C) 2000, 2001, 2013 Gregory Trubetskoy + # Copyright (C) 2000, 2001, 2013, 2024 Gregory Trubetskoy # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you @@ -314,7 +314,8 @@ def makeConfig(self, append=Container()): IfModule("!worker.c", IfModule("!perchild.c", IfModule("!mpm_winnt.c", - LoadModule("mpm_prefork_module modules/mod_mpm_prefork.so"), + LoadModule("mpm_prefork_module %s" % + quote_if_space(os.path.join(modpath, "mod_mpm_prefork.so"))), )))), IfModule("prefork.c", StartServers("3"), @@ -728,7 +729,7 @@ def test_req_allow_methods(self): server_hdr = response.getheader("Allow", "") conn.close() - self.failUnless(server_hdr.find("PYTHONIZE") > -1, "req.allow_methods() didn't work") + self.assertTrue(server_hdr.find("MKWORKSPACE") > -1, "req.allow_methods() didn't work") def test_req_unauthorized_conf(self): @@ -763,10 +764,11 @@ def test_req_unauthorized(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_req_unauthorized", PORT)) - auth = base64.encodestring(b"spam:eggs").strip() if PY2: + auth = base64.encodestring("spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -779,10 +781,11 @@ def test_req_unauthorized(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_req_unauthorized", PORT)) - auth = base64.encodestring(b"spam:BAD PASSWD").strip() if PY2: + auth = base64.encodestring("spam:BAD PASSWD").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:BAD PASSWD").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -828,10 +831,11 @@ def test_req_get_basic_auth_pw(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_req_get_basic_auth_pw", PORT)) - auth = base64.encodestring(b"spam:eggs").strip() if PY2: + auth = base64.encodestring(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -851,10 +855,11 @@ def test_req_get_basic_auth_pw_latin1(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_req_get_basic_auth_pw", PORT)) - auth = base64.encodestring(b'sp\xe1m:\xe9ggs').strip() if PY2: + auth = base64.encodestring('sp\xe1m:\xe9ggs').strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b'sp\xe1m:\xe9ggs').strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -919,10 +924,11 @@ def test_req_requires(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_req_requires", PORT)) - auth = base64.encodestring(b"spam:eggs").strip() if PY2: + auth = base64.encodestring("spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -2483,10 +2489,11 @@ def test_publisher_auth_nested(self): #conn.set_debuglevel(1000) conn.putrequest("GET", "/tests.py/test_publisher_auth_nested", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_publisher_auth_nested", PORT)) - auth = base64.encodestring(b"spam:eggs").strip() if PY2: + auth = base64.encodestring("spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -2512,10 +2519,11 @@ def test_publisher_auth_method_nested(self): conn = http_connection("127.0.0.1:%s" % PORT) conn.putrequest("GET", "/tests.py/test_publisher_auth_method_nested/method", skip_host=1) conn.putheader("Host", "%s:%s" % ("test_publisher_auth_method_nested", PORT)) - auth = base64.encodestring(b"spam:eggs").strip() if PY2: + auth = base64.encodestring("spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth) else: + auth = base64.encodebytes(b"spam:eggs").strip() conn.putheader("Authorization", "Basic %s" % auth.decode("latin1")) conn.endheaders() response = conn.getresponse() @@ -2851,7 +2859,7 @@ def testLoadModule(self): f = urlopen("http://127.0.0.1:%s/tests.py" % PORT) server_hdr = f.info()["Server"] f.close() - self.failUnless(server_hdr.find("Python") > -1, + self.assertTrue(server_hdr.find("Python") > -1, "%s does not appear to load, Server header does not contain Python" % MOD_PYTHON_SO) @@ -2875,8 +2883,13 @@ def testVersionCheck(self): if "mod_python version mismatch" in log: self.fail("version mismatch found in logs, but versions should be same?") - from distutils.sysconfig import get_python_lib - version_path = os.path.join(get_python_lib(), "mod_python", "version.py") + if sys.version_info[0]*100 + sys.version_info[1] > 310: + from sysconfig import get_path + lib = get_path('platlib') + else: + from distutils.sysconfig import get_python_lib + lib = get_python_lib() + version_path = os.path.join(lib, "mod_python", "version.py") # the rest of this test requires write perms to site-packages/mod_python if os.access(version_path, os.W_OK): @@ -3038,7 +3051,7 @@ def testPerRequestTests(self): tr = unittest.TextTestRunner() result = tr.run(perRequestSuite) - self.failUnless(result.wasSuccessful()) + self.assertTrue(result.wasSuccessful()) def test_srv_register_cleanup(self): @@ -3152,4 +3165,3 @@ def suite(): tr = unittest.TextTestRunner() tr.run(suite()) -