[mod_python] null pointer to PyObject_CallMethod

Christian Boos cboos at neuf.fr
Sun Mar 25 15:32:32 EST 2007

Graham Dumpleton wrote:
> On 25/03/07, Christian Boos <cboos at neuf.fr> wrote:
>> Graham Dumpleton wrote:
>> > ..... Confirm in your application that main interpreter is being used
>> > by dumping out
>> > 'apache.interpreter' or 'req.interpreter'.
>> Interesting, I can see some use for that in Trac, as running in
>> sub-interpreters also proves to be problematic for us.
> This comment suggested you might be involved with the development of
> Trac. Is that the case or are you just a dedicated user?

I'm indeed a Trac developer, and in the comment above I was referring to 
add those informations to the "system information" we display in the 
About page or sent in the semi-automated error reports, in Trac 0.11 
(when logged as TRAC_ADMINs).

>> That's a known problem together with the Subversion bindings,
> But which isn't as far I have been able to work out because mod_python
> has bugs as some still occasionally suggest, but because of how the
> Subversion bindings are implemented. :-(

The problem, as I see it, is that using sub-interpreters with extensions 
is a kind of gray area, as documented in the "Bugs and caveats" 
paragraphs of the Python/C API 
(http://docs.python.org/api/initialization.html). The fact that 
mod_python exposes the web application code to this "dangerous zone" 
contributes to shift the blame on mod_python, even though it just 
uncovers subtle bugs and incompatibilities in the extensions themselves.

> ...
> What I would have done would have been to move that import to global
> scope and see if the problem goes away, or fiddle the code to add a
> try/except block and when the error occurs dump out as much
> information as possible about what module is bound to MySQLdb
> reference to try and identify whether it truely is MySQLdb or
> something totally different.

Yes, this we can do, thanks for the suggestion.

-- Christian

More information about the Mod_python mailing list