Skip to content
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

Fix function macros with empty params list #189

Merged
merged 2 commits into from
Dec 17, 2023
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions ctypesgen/printer_python/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,12 @@ def print_variable(self, variable):
)

def print_macro(self, macro):
if macro.params:
self.print_func_macro(macro)
else:
# important: must check precisely against None because params may be
# an empty list for a func macro
if macro.params is None:
self.print_simple_macro(macro)
else:
self.print_func_macro(macro)

def print_simple_macro(self, macro):
# The macro translator makes heroic efforts but it occasionally fails.
Expand Down