[Python-Dev] Python 3.7: remove all private C functions from the Python C API? (original) (raw)

Victor Stinner victor.stinner at gmail.com
Sun Sep 11 04:37:58 EDT 2016


Hi,

Currently, Python has 3 C API:

For practical purpose, all functions are declared in Include/*.h. Basically, Python exposes "everything". There are private functions which are exported using PyAPI_FUNC(), whereas they should only be used inside Python "core". Technically, I'm not sure that we can get ride of PyAPI_FUNC() because the stdlib also has extensions which use a few private functions.

For Python 3.7, I propose that we move all these private functions in separated header files, maybe Include/private/ or Include/core/, and not export them as part of the "regular API".

The risk is that too many C extensions rely on all these tiny "private" functions. Maybe for performance. I don't know.

What do you think?

See also the issue #26900, "Exclude the private API from the stable API": http://bugs.python.org/issue26900

Victor



More information about the Python-Dev mailing list