[Python-Dev] multiple interpreters and extension modules

"Martin v. Löwis" martin at v.loewis.de
Sat Dec 30 02:23:43 CET 2006


Jeremy Kloth schrieb:
>> I think you understand exactly what is happening. It is happening for
>> good reasons. Rather than asking for a change in semantics, I
>> recommend that you deal with it, either in your Python code, or in
>> your extension. It's not likely to change.
> 
> I don't believe I was asking for a change in semantics, rather an additional, 
> optional interface for extension module writers.

And that *is* a change in semantics. The algorithm run by the
interpreter on module startup will be different from
what it is now, i.e. it is a behavior (semantic) change.

> I'll add here that it has been brought up here before that extension module 
> finalization is a feature that would be appreciated.  With that, it is not 
> that far to add support for initialization/finalization for each interpreter. 
> That is, of course, using a DllMain-like solution.

I wouldn't like to see a DllMain-like solution. Instead, there should be
a function vector, and a specification which function is called in what
cases. There should be an entry point that typically just returns a
pointer to this module vtable.

> With that approach in mind, I will be making changes so 4Suite will work in a 
> production mod_python deployment (where the aforementioned error occurred). 
> When that works, I'll come back with a proper PEP *and* patches against 
> Python SVN to support its use. I hope no one was thinking I wanted someone 
> else to do the work.

I was actually going to, for several years now. Please do write the PEP
before making the implementation.

Regards,
Martin



More information about the Python-Dev mailing list