[Python-Dev] What do PyAPI_FUNC & PyAPI_DATA mean?

martin at v.loewis.de martin at v.loewis.de
Tue Apr 24 19:21:32 CEST 2012

Quoting Kristján Valur Jónsson <kristjan at ccpgames.com>:

> You know that I'm speaking of Windows, right?

Yes, but this may only be valid for CCP; for CPython, we certainly
have to consider Unix as well.

> IMHO, we shouldn't put the PyAPI* stuff on functions unless they are  
> actual API functions.
> I don't know how the export tables for ELF .so objects is generated,  
> but it surely can't export _everything_.

It certainly does. Any global symbol in an ELF shared library gets
exported. There are recent (10 years or so) ways to restrict this,
by declaring symbols as hidden in the object file, but exporting
everything is the default that Python uses.

> Anyway, marking stuff as part of the API makes  sense, and marking
> functions as being part of the API makes no sense and is wasteful  
> when they are not.

There are cases where it's necessary: when an extension module
uses a function that is not in the API.

> We might even have something similar for the stable api.

I don't understand. Everything in the stable api is part
of the API, and thus needs to be exported from the Python DLL.


More information about the Python-Dev mailing list