[Python-Dev] Python 3.7: remove all private C functions from the Python C API? (original) (raw)
Benjamin Peterson benjamin at python.org
Mon Sep 12 02:23:53 EDT 2016
- Previous message (by thread): [Python-Dev] Python 3.7: remove all private C functions from the Python C API?
- Next message (by thread): [Python-Dev] Python 3.7: remove all private C functions from the Python C API?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
That seems like a good idea in abstract. However, the boundaries will have to be delineated. Many functions beginning _Py are effectively part of the public API even for "well-behaved" 3rd-party extensions because they are used by magic macros. For example, _Py_Dealloc is used by Py_DECREF.
Ideally, we would set the linkage of functions we really didn't want used externally to "hidden".
On Sun, Sep 11, 2016, at 01:37, Victor Stinner wrote:
Hi,
Currently, Python has 3 C API: * python core API * regular API: subset of the core API * stable API (ABI?), the PyLIMITEDAPI thing: subset of the regular API For practical purpose, all functions are declared in Include/*.h. Basically, Python exposes "everything". There are private functions which are exported using PyAPIFUNC(), whereas they should only be used inside Python "core". Technically, I'm not sure that we can get ride of PyAPIFUNC() 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
Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/benjamin%40python.org
- Previous message (by thread): [Python-Dev] Python 3.7: remove all private C functions from the Python C API?
- Next message (by thread): [Python-Dev] Python 3.7: remove all private C functions from the Python C API?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]