[Image-SIG] Python C API mismatch

Fredrik Lundh fredrik@pythonware.com
Fri, 16 Nov 2001 08:23:27 +0100


terry wrote:

> I think I understand what it means, but how serious
> is it?  If not serious, can I make it go away?

not very serious, in this case.  but it's easy to fix.

> I guess this means that the imaging module identifies
> itself as using the 1009 API, and the newer Python
> (2.1.1) recognizes the difference.  Therefore, I would
> expect that recompiling alone would not be enough --
> I'd have to find and change the reference to the API.

nope -- just rebuild, and all will be fine.

the magic code is provided by Python's include files, and
is passed back to the Python interpreter via a preprocessor
trick:

$ more Include/modsupport.h
...
#define PYTHON_API_VERSION 1011
...
#define Py_InitModule(name, methods) \
 Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \
         PYTHON_API_VERSION)

> Is there a good resource to use to find out what API
> changes were made and is there any quick way to figure
> out whether a given piece of code will be broken by
> such a change?

there's a brief summary in the modsupport.h file, but that's
written with module authors in mind, not regular users.  you
need to need to know your piece of code pretty well before
you can say what's safe and what's not.

</F>