• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2
3# Any PyObject exposed via the public API is problematic since it must
4# be made per-interpreter.  This involves the following:
5#
6# singletons:
7#  - None
8#  - True
9#  - False
10#  - NotImplemented
11#  - Ellipsis
12# PyTypeObject:
13#  - PyExc*  [97]
14#  - static types  [81]
15#
16# In the non-stable API we could use #defines to do the conversion
17# transparently (though Py_None is perhaps problematic for performance
18# reasons).  However, we can't take that approach with the stable API.
19# That means we must find all functions (& macros) in the stable API
20# (and probably the full public API, for sanity sake) and adjust them.
21# This will involve internally converting from the public object to the
22# corresponding per-interpreter object.
23#
24# Note that the only place this solution fails is with direct pointer
25# equality checks with the public objects.
26
27# XXX What about saying that the stable API is not sub-interpreter
28# compatible?
29
30
31function run_capi() {
32    ./python Tools/c-analyzer/c-analyzer.py capi \
33        --no-progress \
34        --group-by kind \
35        --func --inline --macro \
36        --no-show-empty \
37        --ignore '<must-resolve.ignored>' \
38        $@
39}
40
41echo ''
42echo '#################################################'
43echo '# All API'
44echo '#################################################'
45run_capi --format summary Include/*.h Include/cpython/*.h
46run_capi --format table Include/*.h Include/cpython/*.h
47echo ''
48echo ''
49echo '#################################################'
50echo '# stable API'
51echo '#################################################'
52echo ''
53echo '# public:'
54run_capi --format summary --public --no-show-empty Include/*.h
55echo ''
56echo '# private:'
57run_capi --format summary --private --no-show-empty Include/*.h
58echo ''
59run_capi --format full -v Include/*.h
60#run_capi --format full -v --public Include/*.h
61#run_capi --format full -v --private Include/*.h
62echo ''
63echo '#################################################'
64echo '# cpython API'
65echo '#################################################'
66echo ''
67echo '# public:'
68run_capi --format summary --public --no-show-empty Include/cpython/*.h
69echo ''
70echo '# private:'
71run_capi --format summary --private --no-show-empty Include/cpython/*.h
72echo ''
73run_capi --format full -v Include/cpython/*.h
74#run_capi --format full -v --public Include/cpython/*.h
75#run_capi --format full -v --private Include/cpython/*.h
76