[Python-Dev] Supporting Visual Studio 2010

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 5 22:02:23 CEST 2011


> <http://www.python.org/dev/peps/pep-0384/> says "functions expecting
> FILE* are not part of the ABI, to avoid depending on a specific
> version of the Microsoft C runtime DLL on Windows".  Can extension
> modules that need to read and write files practically avoid all of
> those functions?

Certainly! fread/fwrite/fprintf is not part of the Python API at all,
so clearly doesn't need to be part of the ABI.

> (If your extension module links a library with a
> different CRT, but doesn't pass functions back and forth to Python,
> is that OK?)

It is (and always was). The difficult functions are PyRun_AnyFileFlags
and friends.

> The PEP also says that it will allow users to "check whether their
> modules conform to the ABI", but it doesn't say how that will be
> done.  How can we build extension modules so that we're sure we're
> ABI-conformant?

If it compiles with Py_LIMITED_API defined, and links successfully
on Windows, it should be ABI-conforming (unless you deliberately
bypass the test, e.g. by replicating struct definitions in your
own code).

Regards,
Martin


More information about the Python-Dev mailing list