[Python-Dev] Procedure for adding new public C API

Serhiy Storchaka storchaka at gmail.com
Mon May 21 08:41:59 EDT 2018


Please don't forgot to perform the following steps when add a  new 
public C API:

* Document it in Doc/c-api/.

* Add an entry in the What's New document.

* Add it in Doc/data/refcounts.dat.

* Add it in PC/python3.def.

If you want to include it in the limited API, wrap its declaration with:

    #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000
    #endif

(use the correct Python version of introducing a feature in the comparison)

If you don't want to include it in the limited API, wrap its declaration 
with:

    #ifndef Py_LIMITED_API
    #endif

You are free of adding private C API, but its name should start with _Py 
or _PY and its declaration should be wrapped with:

    #ifndef Py_LIMITED_API
    #endif



More information about the Python-Dev mailing list