[mod_python] quick code review

Gregory Trubetskoy grisha at modpython.org
Mon May 29 11:44:15 EST 2000

On Thu, 25 May 2000, Greg Stein wrote:

> *) rather than storing the "request object" into r->notes, place it into
>    tstate->dict. you won't have to do the atoi() stuff (which is Bad
>    anyways)

This won't work. Or rather it will, but it's getting too complex to be
worth it. 

The problem is that a single request can span multiple thread states - a
typical scenario is when there is a PythonAuthenHandler directive
somewhere in a parent directory and a PythonHandler directive in a
subdirectory. The two handlers will be executed in different
subinterpreters, thereofre having different tstates and result in two
separate requestobjects being instantiated. 

So you get the malloc penalty plus the complexity of dealing with the
tstate->dict dictionary (which too will need to be created, another
malloc) for not much of a practical gain other than proper code, which,
btw, becomes kind of arcane and hard to understand (a bad thing as well).

It seems to me that I am working around what is really an Apache
limitation. The request_rec is clearly the right place to store a pointer
to a requestobject for that request_rec, the limitation is that the place
alloted for these sorts of things (r->notes) only deals with strings.

I think there needs to be something similar to r->notes that can take a
pointer. For now, I think I'm going to revert to the atoi stuff...


More information about the Mod_python mailing list