Statistics on the Python C API

Functions

Functions exported with PyAPI_FUNC():

Python

Public

Private

Internal

Total

2.7.0

738

159

0

897

3.6.0

844 (+106)

382 (+223)

0 (same)

1,226 (+329)

3.7.0

869 (+25)

450 (+68)

16 (+16)

1,335 (+109)

3.8.0

909 (+40)

429 (-21)

83 (+67)

1,421 (+86)

3.9.0

919 (+10)

412 (-17)

114 (+31)

1,445 (+24)

3.10.0

885 (-34)

412 (same)

120 (+6)

1,417 (-28)

3.11.0

891 (+6)

360 (-52)

181 (+61)

1,432 (+15)

3.12.0

929 (+38)

389 (+29)

179 (-2)

1,497 (+65)

main (3.13)

961 (+32)

105 (-284)

295 (+116)

1,361 (-136)

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.0

129

30

0

159

3.6.0

167 (+38)

42 (+12)

0 (same)

209 (+50)

3.7.0

170 (+3)

35 (-7)

9 (+9)

214 (+5)

3.8.0

174 (+4)

37 (+2)

12 (+3)

223 (+9)

3.9.0

173 (-1)

35 (-2)

14 (+2)

222 (-1)

3.10.0

173 (same)

33 (-2)

13 (-1)

219 (-3)

3.11.0

177 (+4)

32 (-1)

10 (-3)

219 (same)

3.12.0

176 (-1)

30 (-2)

11 (+1)

217 (-2)

main (3.13)

180 (+4)

14 (-16)

24 (+13)

218 (+1)

Line Numbers

Number of C API line numbers per Python version:

Python

Limited API

CPython API

Internal API

Total

2.7.0

12,392 (100%)

0 (0%)

0 (0%)

12,392

3.6.0

15,330 (100%)

0 (0%)

0 (0%)

15,330

3.7.0

15,943 (96%)

0 (0%)

703 (4%)

16,646

3.8.0

12,648 (69%)

3,418 (19%)

2,241 (12%)

18,307

3.9.0

11,744 (61%)

4,359 (23%)

3,118 (16%)

19,221

3.10.0

9,909 (49%)

4,584 (23%)

5,553 (28%)

20,046

3.11.0

8,733 (36%)

5,407 (22%)

10,079 (42%)

24,219

3.12.0

9,012 (28%)

5,836 (18%)

17,650 (54%)

32,498

main (3.13)

8,951 (22%)

7,828 (19%)

24,230 (59%)

41,009

File Numbers

Number of header file numbers per Python version:

Python

Limited API

CPython API

Internal API

Total

2.7.0

91

0

0

91

3.6.0

98 (+7)

0 (same)

0 (same)

98 (+7)

3.7.0

98 (same)

0 (same)

12 (+12)

110 (+12)

3.8.0

96 (-2)

15 (+15)

22 (+10)

133 (+23)

3.9.0

97 (+1)

24 (+9)

34 (+12)

155 (+22)

3.10.0

80 (-17)

32 (+8)

49 (+15)

161 (+6)

3.11.0

71 (-9)

47 (+15)

69 (+20)

187 (+26)

3.12.0

71 (same)

49 (+2)

91 (+22)

211 (+24)

main (3.13)

71 (same)

54 (+5)

119 (+28)

244 (+33)

Public functions defined as macros and static inline functions

Public functions defined as macros and static inline functions:

Python

Macro

Static inline

Total

2.7.0

274

0

274

3.6.0

306 (+32)

0 (same)

306 (+32)

3.7.0

315 (+9)

0 (same)

315 (+9)

3.8.0

314 (-1)

0 (same)

314 (-1)

3.9.0

307 (-7)

0 (same)

307 (-7)

3.10.0

307 (same)

0 (same)

307 (same)

3.11.0

269 (-38)

42 (+42)

311 (+4)

3.12.0

251 (-18)

64 (+22)

315 (+4)

main (3.13)

246 (-5)

63 (-1)

309 (-6)

Only count public macros and public static inline functions (names starting with “Py” or “PY”).

Private functions defined as macros and static inline functions

Private functions defined as macros and static inline functions:

Python

Macro

Static inline

Total

2.7.0

21

0

21

3.6.0

60 (+39)

0 (same)

60 (+39)

3.7.0

70 (+10)

0 (same)

70 (+10)

3.8.0

57 (-13)

7 (+7)

64 (-6)

3.9.0

43 (-14)

11 (+4)

54 (-10)

3.10.0

44 (+1)

18 (+7)

62 (+8)

3.11.0

53 (+9)

4 (-14)

57 (-5)

3.12.0

62 (+9)

7 (+3)

69 (+12)

main (3.13)

59 (-3)

9 (+2)

68 (-1)

Only count private macros and public static inline functions (ignore names starting with “Py” or “PY”).

Structures

Structures in the Python C API:

Python

Limited API

CPython API

Internal API

Total

2.7.0

91

0

0

91

3.6.0

109 (+18)

0 (same)

0 (same)

109 (+18)

3.7.0

114 (+5)

0 (same)

18 (+18)

132 (+23)

3.8.0

81 (-33)

34 (+34)

28 (+10)

143 (+11)

3.9.0

68 (-13)

46 (+12)

38 (+10)

152 (+9)

3.10.0

41 (-27)

53 (+7)

91 (+53)

185 (+33)

3.11.0

19 (-22)

75 (+22)

112 (+21)

206 (+21)

3.12.0

18 (-1)

85 (+10)

170 (+58)

273 (+67)

main (3.13)

17 (-1)

90 (+5)

219 (+49)

326 (+53)

Count also private structures like “_PyCFrame” and structures with names not starting with Py like “_frozen”.