Copterfly / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Port mod_wsgi to Python 3.0. #70

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Port mod_wsgi to Python 3.0. For guide on how WSGI specification needs to be 
reinterpreted for 
Python 3.0 see:

  http://www.wsgi.org/wsgi/Amendments_1.0

Original issue reported on code.google.com by Graham.Dumpleton@gmail.com on 26 Mar 2008 at 9:52

GoogleCodeExporter commented 8 years ago
Support for Python 3.0 now in trunk of subversion repository.

Original comment by Graham.Dumpleton@gmail.com on 6 Apr 2008 at 11:20

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 11 Apr 2008 at 5:42

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 7 Jul 2008 at 2:20

GoogleCodeExporter commented 8 years ago
Python 3.0 beta 3 (or perhaps earlier beta) breaks existing code changes. More 
porting work required.

Original comment by Graham.Dumpleton@gmail.com on 24 Aug 2008 at 7:21

GoogleCodeExporter commented 8 years ago
Fixed so compiles with Python 3.0 beta, but crashes when main interpreter isn't 
used. Thus need:

  WSGIApplicationGroup %{GLOBAL}

for now.

Original comment by Graham.Dumpleton@gmail.com on 4 Sep 2008 at 12:24

GoogleCodeExporter commented 8 years ago
The problem appears to be that 'sys' module isn't initialised in secondary 
interpreter. This is supposed to be 
done in Py_NewInterpreter() but must be something about what thread state is 
held at time that this is done that 
is causing problems.

Original comment by Graham.Dumpleton@gmail.com on 19 Sep 2008 at 11:12

GoogleCodeExporter commented 8 years ago
Need to validate parts of mod_wsgi which try and shutdown threading and invoke 
exit functions still work.

This is because PEP 8 conformance changes are likely to have changed the names 
of some things. There are possibly 
backward compatible aliases for these, eg:

  currentThread = current_thread

but need to make sure and going forward, need to make sure new names are used 
in case old are removed.

Also, appears that sys.exitfunc() no longer exists, possibly being replaced by 
atexit._run_exitfuncs().

Original comment by Graham.Dumpleton@gmail.com on 19 Sep 2008 at 11:48

GoogleCodeExporter commented 8 years ago
Problems with Py_NewInterpreter in Python 3.0 recorded at:

  http://bugs.python.org/issue3723

My bug report:

  http://bugs.python.org/issue3919

was regarded as duplicate of that.

Original comment by Graham.Dumpleton@gmail.com on 21 Sep 2008 at 11:01

GoogleCodeExporter commented 8 years ago
Code updated for atexit functions and does right thing for main interpreter. In 
a sub interpreter, end up seeing this message:

[Fri Oct 24 17:44:29 2008] [info] mod_wsgi (pid=2579): Destroy interpreter 
'dangermouse.isd.rta.nsw.gov.au:8224|/wsgi/scripts/echo3000.py'.
[Fri Oct 24 17:44:29 2008] [info] mod_wsgi (pid=2580): Cleanup interpreter ''.
[Fri Oct 24 17:44:29 2008] [info] mod_wsgi (pid=2580): Terminating Python.
[Fri Oct 24 17:44:29 2008] [error] PYTHON 3.0 ATEXIT
[Fri Oct 24 17:44:29 2008] [error] PID 2579
[Fri Oct 24 17:44:29 2008] [error] PROCESS b''
[Fri Oct 24 17:44:29 2008] [error] APPLICATION 
b'dangermouse.isd.rta.nsw.gov.au:8224|/wsgi/scripts/echo3000.py'
[Fri Oct 24 17:44:30 2008] [info] mod_wsgi (pid=2579): Cleanup interpreter ''.
[Fri Oct 24 17:44:30 2008] [info] mod_wsgi (pid=2579): Terminating Python.
[Fri Oct 24 17:44:30 2008] [error] Error in atexit._run_exitfuncs:
[Fri Oct 24 17:44:30 2008] [error] TypeError: print_exception(): Exception 
expected for value, str found

Ie., error out of print_exception(). This is probably from some mod_wsgi call, 
but need to track down where.

The string values or mod_wsgi.process_group and mod_wsgi.application_group 
should be unicode and not byte strings.

Original comment by Graham.Dumpleton@gmail.com on 24 Oct 2008 at 6:47

GoogleCodeExporter commented 8 years ago
Byte string issue for process_group and application_group attributes of 
mod_wsgi module fixed at revision 1097.

Original comment by Graham.Dumpleton@gmail.com on 24 Oct 2008 at 6:53

GoogleCodeExporter commented 8 years ago
The atexit callback problem is possibly due to atexit module no longer being 
friendly to multiple sub 
interpreters. Specifically, callbacks no longer registered at Python code level 
in sub interpreter but a C code 
level. As no separation, callback list is global across all sub interpreters. 
When Py_Finalize() is called, it will 
call callbacks for all sub interpreters against context of main sub interpreter.

This is wrong to start with, but mod_wsgi compounds it as it attempts to call 
callbacks for a sub interpreter, 
but list being global means all callbacks get called for all interpreters. That 
is, called multiple times and with 
wrong interpreter context when called.

See:

  http://bugs.python.org/issue4200

May have to install own 'atexit' module into sub interpreters that replaces 
Python supplied one, implemented 
so as to ensure that callbacks are isolated to specific sub interpreter.

Original comment by Graham.Dumpleton@gmail.com on 24 Oct 2008 at 10:55

GoogleCodeExporter commented 8 years ago
Patches available for Python 3.0 problems. Need to check out Python source code 
and apply and test.

   http://bugs.python.org/issue3723
   http://bugs.python.org/issue4200
   http://bugs.python.org/issue4213

Original comment by Graham.Dumpleton@gmail.com on 28 Oct 2008 at 11:33

GoogleCodeExporter commented 8 years ago
Patches for Python 3.0 against those issues appears to fix outstanding problems.

Original comment by Graham.Dumpleton@gmail.com on 30 Oct 2008 at 12:12

GoogleCodeExporter commented 8 years ago
Patches now in subversion trunk for Python 3.0. Still works.

Original comment by Graham.Dumpleton@gmail.com on 30 Oct 2008 at 10:40

GoogleCodeExporter commented 8 years ago
The python-path and likely also WSGIPythonPath aren't working for Python 3.0. 
For:

python-path=/tmp/a:/tmp/b:/tmp/c

One sees in log files when debug on:

[Thu Dec 04 21:33:03 2008] [info] mod_wsgi (pid=9471): Adding '(null)' to path.
[Thu Dec 04 21:33:03 2008] [info] mod_wsgi (pid=9471): Adding '(null)' to path.
[Thu Dec 04 21:33:03 2008] [info] mod_wsgi (pid=9471): Adding '/tmp/c' to path.

Original comment by Graham.Dumpleton@gmail.com on 4 Dec 2008 at 10:39

GoogleCodeExporter commented 8 years ago
The incorrect output in logging output is a problem with the logging only. 
Still needs to be fixed.

Original comment by Graham.Dumpleton@gmail.com on 4 Dec 2008 at 11:35

GoogleCodeExporter commented 8 years ago
Version 3.0 of mod_wsgi now released with Python 3.X support. See:

http://code.google.com/p/modwsgi/wiki/SupportForPython3X

for details.

Presumed that log message error got fixed. :-)

Original comment by Graham.Dumpleton@gmail.com on 22 Nov 2009 at 2:52