<p dir="ltr">In general I support cleaning up our C API to moreĀ  clearly delineate the boundaries of what people can rely on and what they shouldn't. Could we go farther and do the same separation of the base and limited API at the header level instead of interleaving through #ifndef?</p>
<br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 11, 2016, 01:38 Victor Stinner <<a href="mailto:victor.stinner@gmail.com">victor.stinner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Currently, Python has 3 C API:<br>
<br>
* python core API<br>
* regular API: subset of the core API<br>
* stable API (ABI?), the Py_LIMITED_API thing: subset of the regular API<br>
<br>
For practical purpose, all functions are declared in Include/*.h.<br>
Basically, Python exposes "everything". There are private functions<br>
which are exported using PyAPI_FUNC(), whereas they should only be<br>
used inside Python "core". Technically, I'm not sure that we can get<br>
ride of PyAPI_FUNC() because the stdlib also has extensions which use<br>
a few private functions.<br>
<br>
For Python 3.7, I propose that we move all these private functions in<br>
separated header files, maybe Include/private/ or Include/core/, and<br>
not export them as part of the "regular API".<br>
<br>
The risk is that too many C extensions rely on all these tiny<br>
"private" functions. Maybe for performance. I don't know.<br>
<br>
What do you think?<br>
<br>
See also the issue #26900, "Exclude the private API from the stable API":<br>
<a href="http://bugs.python.org/issue26900" rel="noreferrer" target="_blank">http://bugs.python.org/issue26900</a><br>
<br>
Victor<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/brett%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div>