Skip to content

Commit

Permalink
Fix macro regex
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Dec 6, 2022
1 parent a41a2bc commit 1fbd866
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions doc/pythoncapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def grep(regex, filenames, group=0):
def get_macros_static_inline_funcs():
files = list_files(PATH_LIMITED_API) + list_files(PATH_CPYTHON_API)

args = r'[a-zA-Z][a-zA-Z_, ]*'
regex = re.compile(fr'^ *# *define (P[Yy][A-Za-z_]+) *\( *{args}\)', re.MULTILINE)
# Match '#define func('
# Don't match '#define constant (&obj)': space before '('
regex = re.compile(fr'^ *# *define (P[Yy][A-Za-z_]+)\(', re.MULTILINE)
macros = set(grep(regex, files, group=1))

regex = re.compile(fr'^static inline [^(\n]+ ({RE_IDENTIFIER}) *\(', re.MULTILINE)
Expand Down
16 changes: 8 additions & 8 deletions doc/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ Functions defined as macros (only public) and static inline functions (public or
====== ========== ============= ==========
Python Macro Static inline Total
====== ========== ============= ==========
2.7 274 0 274
3.6 305 (+31) 18 (+18) 323 (+49)
3.7 312 (+7) 22 (+4) 334 (+11)
3.8 311 (-1) 31 (+9) 342 (+8)
3.9 305 (-6) 35 (+4) 340 (-2)
3.10 305 (same) 42 (+7) 347 (+7)
3.11 267 (-38) 70 (+28) 337 (-10)
3.12 244 (-23) 93 (+23) 337 (same)
2.7 276 0 276
3.6 306 (+30) 18 (+18) 324 (+48)
3.7 315 (+9) 22 (+4) 337 (+13)
3.8 314 (-1) 31 (+9) 345 (+8)
3.9 307 (-7) 35 (+4) 342 (-3)
3.10 307 (same) 42 (+7) 349 (+7)
3.11 269 (-38) 70 (+28) 339 (-10)
3.12 246 (-23) 93 (+23) 339 (same)
====== ========== ============= ==========

Structures
Expand Down

0 comments on commit 1fbd866

Please sign in to comment.