-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-121404: remove redundant c_nestlevel. more compiler abstractions. more macro usage consistency #123225
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
Conversation
…ions. more macro usage consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpick.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@@ -92,11 +92,18 @@ static PySTEntryObject *compiler_symtable_entry(struct compiler *c); | |||
#define FUTURE_FEATURES(C) compiler_future_features(C) | |||
#define SYMTABLE(C) compiler_symtable(C) | |||
#define SYMTABLE_ENTRY(C) compiler_symtable_entry(C) | |||
#define OPTIMIZATION_LEVEL(C) compiler_optimization_level(C) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize we have some similar macros already, but is it really worth adding a macro that just replaces a slightly longer function call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually the functions will be in a different file, and potentially we will want to support alternative definitions of these macros. It's easier to redefine a macro than a function, and the code generation code is heavily macro-based anyway, so I think it makes sense to stick to this style.
RETURN_IF_ERROR(ret); | ||
return SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RETURN_IF_ERROR(ret); | |
return SUCCESS; | |
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately didn't do this so that the pattern of checking for error with the macro is used everywhere. If you decide to add more code to this function, you can add it between line 1500 and 1501 without changing any of the existing code.
RETURN_IF_ERROR(ret); | ||
return SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RETURN_IF_ERROR(ret); | |
return SUCCESS; | |
return ret; |
Uh oh!
There was an error while loading. Please reload this page.