#!/usr/bin/env bash12# Any PyObject exposed via the public API is problematic since it must3# be made per-interpreter. This involves the following:4#5# singletons:6# - None7# - True8# - False9# - NotImplemented10# - Ellipsis11# PyTypeObject:12# - PyExc* [97]13# - static types [81]14#15# In the non-stable API we could use #defines to do the conversion16# transparently (though Py_None is perhaps problematic for performance17# reasons). However, we can't take that approach with the stable API.18# That means we must find all functions (& macros) in the stable API19# (and probably the full public API, for sanity sake) and adjust them.20# This will involve internally converting from the public object to the21# corresponding per-interpreter object.22#23# Note that the only place this solution fails is with direct pointer24# equality checks with the public objects.2526# XXX What about saying that the stable API is not sub-interpreter27# compatible?282930function run_capi() {31./python Tools/c-analyzer/c-analyzer.py capi \32--no-progress \33--group-by kind \34--func --inline --macro \35--no-show-empty \36--ignore '<must-resolve.ignored>' \37$@38}3940echo ''41echo '#################################################'42echo '# All API'43echo '#################################################'44run_capi --format summary Include/*.h Include/cpython/*.h45run_capi --format table Include/*.h Include/cpython/*.h46echo ''47echo ''48echo '#################################################'49echo '# stable API'50echo '#################################################'51echo ''52echo '# public:'53run_capi --format summary --public --no-show-empty Include/*.h54echo ''55echo '# private:'56run_capi --format summary --private --no-show-empty Include/*.h57echo ''58run_capi --format full -v Include/*.h59#run_capi --format full -v --public Include/*.h60#run_capi --format full -v --private Include/*.h61echo ''62echo '#################################################'63echo '# cpython API'64echo '#################################################'65echo ''66echo '# public:'67run_capi --format summary --public --no-show-empty Include/cpython/*.h68echo ''69echo '# private:'70run_capi --format summary --private --no-show-empty Include/cpython/*.h71echo ''72run_capi --format full -v Include/cpython/*.h73#run_capi --format full -v --public Include/cpython/*.h74#run_capi --format full -v --private Include/cpython/*.h757677