10000 bpo-36876: [c-analyzer tool] Add a "capi" subcommand to the c-analyzer tool. by ericsnowcurrently · Pull Request #23918 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-36876: [c-analyzer tool] Add a "capi" subcommand to the c-analyzer tool. #23918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Dec 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ignore comments.
  • Loading branch information
ericsnowcurrently committed Dec 24, 2020
commit c674ff8e67f63da71d202a758a7b0a80cc218ede
11 changes: 7 additions & 4 deletions Tools/c-analyzer/cpython/_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,19 @@ def _parse_line(line, prev=None):
results = zip(KINDS, m.groups())
for kind, name in results:
if name:
clean = last.split('//')[0].strip()
if clean.endswith('*/'):
clean = clean.split('/*')[0].rstrip()
if kind == 'macro' or kind == 'constant':
if line.endswith('\\' + os.linesep):
if clean.endswith('\\'):
return line # the new "prev"
elif kind == 'inline':
if not prev:
if not line.rstrip().endswith('}'):
if not clean.endswith('}'):
return line # the new "prev"
elif last.rstrip() != '}':
elif clean != '}':
return line # the new "prev"
elif not line.endswith(';' + os.linesep):
elif not clean.endswith(';'):
return line # the new "prev"
return name, kind
# It was a plain #define.
Expand Down
0