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

Kristján Valur Jónsson kristjan at ccpgames.com
Mon Apr 23 15:05:35 CEST 2012


IMHO, we are _much_ too generous at applying this to almost whatever gets exposed between .c files.
I have created something called the "restricted" api for our custom python27.dll where I use different
macros (PyAPI_RFUNC, pyAPI_RDATA) to mean that things aren't exported for "restricted" builds.  We
use it to remove some of the easier access points to the dll for hackers to exploit.

Also, once declared exported this way, things become more bothersome to remove again, since once could always argue that someone out there is using these thigns.

K

> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On
> Behalf Of Benjamin Peterson
> Sent: 23. apríl 2012 12:59
> To: Mark Shannon
> Cc: Python Dev
> Subject: Re: [Python-Dev] What do PyAPI_FUNC & PyAPI_DATA mean?
> 
> 2012/4/23 Mark Shannon <mark at hotpy.org>:
> > Many (most?) of the function declarations in the CPython header files
> > are annotated with the PyAPI_FUNC declaration.
> > Similarly for data declarations and PyAPI_DATA
> >
> > What do they mean, exactly? From the name I would expect that they are
> > a way of declaring a function or datum to be part of the API, but
> > their usage seems to be more to do with linkage.
> 
> They define linkage on Windows. I actually don't know if they should be
> applied to internal functions.
> 
> 
> 
> --
> Regards,
> Benjamin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-
> dev/kristjan%40ccpgames.com




More information about the Python-Dev mailing list