[Python-Dev] PYTHON_API_VERSION and threading

Greg Stein gstein@lyra.org
Sun, 9 Apr 2000 02:28:18 -0700 (PDT)


On Fri, 7 Apr 2000, Guido van Rossum wrote:
> > Something that just struck me: couldn't we use a couple of bits in the 
> > PYTHON_API_VERSION to check various other things that make dynamic modules 
> > break? WITH_THREAD is the one I just ran in to, but there's a few others such 
> > as the object refcounting statistics and platform-dependent things like the 
> > debug/nodebug compilation on Windows.
> 
> I'm curious what combination didn't work?  The thread APIs are
> supposed to be designed so that all combinations work -- the APIs are
> always present, they just don't do anything in the unthreaded
> version.  If an extension is compiled without threads, well, then it
> won't release the interpreter lock, of course, but otherwise there
> should be no bad effects.

But if you enable "free threading" or "trace refcounts", then the
combinations will not work. This is because these two options modify very
basic things like Py_INCREF/DECREF. To help prevent mismatches, they do
some monkey work with redefining a Python symbol (the InitModule thingy).

Jack's idea of using PYTHON_API_VERSION is a cleaner approach to
preventing imcompatibilities.

> The debug issue on Windows is taken care of by a DLL naming
> convention: the debug versions are named spam_d.dll (or .pyd).

It would be nice to have it at the code level, too.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/