Statistics on the Python C API¶
Line Numbers¶
Number of C API line numbers per Python version:
Python | Limited API | CPython API | Internal API | Total |
---|---|---|---|---|
2.7 | 12,686 (100%) | 0 (0%) | 0 (0%) | 12,686 |
3.6 | 16,011 (100%) | 0 (0%) | 0 (0%) | 16,011 |
3.7 | 16,517 (96%) | 0 (0%) | 772 (4%) | 17,289 |
3.8 | 13,166 (70%) | 3,417 (18%) | 2,295 (12%) | 18,878 |
3.9 | 12,265 (62%) | 4,358 (22%) | 3,146 (16%) | 19,769 |
3.10 | 10,396 (51%) | 4,616 (22%) | 5,572 (27%) | 20,584 |
3.11 | 9,232 (37%) | 5,495 (22%) | 10,046 (41%) | 24,773 |
3.12 | 9,287 (31%) | 5,651 (19%) | 15,071 (50%) | 30,009 |
File Numbers¶
Number of header file numbers per Python version:
Python | Limited API | CPython API | Internal API | Total |
---|---|---|---|---|
2.7 | 91 | 0 | 0 | 91 |
3.6 | 99 (+8) | 0 (same) | 0 (same) | 99 (+8) |
3.7 | 99 (same) | 0 (same) | 12 (+12) | 111 (+12) |
3.8 | 97 (-2) | 15 (+15) | 22 (+10) | 134 (+23) |
3.9 | 98 (+1) | 24 (+9) | 34 (+12) | 156 (+22) |
3.10 | 81 (-17) | 32 (+8) | 48 (+14) | 161 (+5) |
3.11 | 72 (-9) | 48 (+16) | 68 (+20) | 188 (+27) |
3.12 | 72 (same) | 49 (+1) | 77 (+9) | 198 (+10) |
Functions¶
Functions exported with PyAPI_FUNC():
Python | Public | Private | Internal | Total |
---|---|---|---|---|
2.7 | 758 | 176 | 0 | 934 |
3.6 | 870 (+112) | 378 (+202) | 0 (same) | 1,248 (+314) |
3.7 | 893 (+23) | 445 (+67) | 13 (+13) | 1,351 (+103) |
3.8 | 926 (+33) | 420 (-25) | 79 (+66) | 1,425 (+74) |
3.9 | 937 (+11) | 405 (-15) | 110 (+31) | 1,452 (+27) |
3.10 | 902 (-35) | 406 (+1) | 116 (+6) | 1,424 (-28) |
3.11 | 931 (+29) | 351 (-55) | 177 (+61) | 1,459 (+35) |
3.12 | 943 (+12) | 358 (+7) | 176 (-1) | 1,477 (+18) |
Since Python 3.9, Python is now built with -fvisibility=hidden
to avoid
exporting symbols which are not explicitly exported.
The make smelly
command checks for public symbols of libpython and C
extension which are prefixed by Py
or _Py
. See
the Tools/scripts/smelly.py
script.
Variables¶
Symbols exported with PyAPI_DATA():
Python | Public | Private | Internal | Total |
---|---|---|---|---|
2.7 | 133 | 31 | 0 | 164 |
3.6 | 171 (+38) | 41 (+10) | 0 (same) | 212 (+48) |
3.7 | 175 (+4) | 34 (-7) | 9 (+9) | 218 (+6) |
3.8 | 179 (+4) | 36 (+2) | 12 (+3) | 227 (+9) |
3.9 | 178 (-1) | 34 (-2) | 14 (+2) | 226 (-1) |
3.10 | 178 (same) | 35 (+1) | 13 (-1) | 226 (same) |
3.11 | 182 (+4) | 32 (-3) | 10 (-3) | 224 (-2) |
3.12 | 183 (+1) | 30 (-2) | 9 (-1) | 222 (-2) |
Functions defined as macros and static inline functions¶
Functions defined as macros (only public) and static inline functions (public or private):
Python | Macro | Static inline | Total |
---|---|---|---|
2.7 | 276 | 0 | 276 |
3.6 | 306 (+30) | 0 (same) | 306 (+30) |
3.7 | 315 (+9) | 0 (same) | 315 (+9) |
3.8 | 314 (-1) | 7 (+7) | 321 (+6) |
3.9 | 307 (-7) | 11 (+4) | 318 (-3) |
3.10 | 307 (same) | 18 (+7) | 325 (+7) |
3.11 | 269 (-38) | 46 (+28) | 315 (-10) |
3.12 | 246 (-23) | 69 (+23) | 315 (same) |
Structures¶
Structures in the Python C API:
Python | Limited API | CPython API | Internal API | Total |
---|---|---|---|---|
2.7 | 92 | 0 | 0 | 92 |
3.6 | 110 (+18) | 0 (same) | 0 (same) | 110 (+18) |
3.7 | 114 (+4) | 0 (same) | 18 (+18) | 132 (+22) |
3.8 | 81 (-33) | 34 (+34) | 28 (+10) | 143 (+11) |
3.9 | 68 (-13) | 46 (+12) | 38 (+10) | 152 (+9) |
3.10 | 41 (-27) | 53 (+7) | 91 (+53) | 185 (+33) |
3.11 | 19 (-22) | 75 (+22) | 112 (+21) | 206 (+21) |
3.12 | 17 (-2) | 80 (+5) | 140 (+28) | 237 (+31) |