bpo-43502: Convert PyExceptionClass_Check from macro to static inline function by erlend-aasland · Pull Request #24875 · python/cpython
cc. @vstinner
Should the NEWS entry include more info? For example "the macro was problematic because it reused its arguments twice".
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the function is not used in performance critical hot code, the macro can be converted to a regular function (not a static function).
If the function is not used in performance critical hot code, the macro can be converted to a regular function (not a static function).
My gut feeling is to convert PyExceptionClass_Check to a static inlined function, not a regular function. Let me know if you want it to be a regular C function.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include/ contains more than 450+ functions defined as macros. I don't want to have to review 450 PRs to change all macros.
Do you have an idea on how many macros have the double evaluation bug?
Include/ contains more than 450+ functions defined as macros. I don't want to have to review 450 PRs to change all macros.
Do you have an idea on how many macros have the double evaluation bug?
I doubt all of them are clearly problematic. I'll see if I can create a list of worst cases and put it on the issue.
UPDATE There are 88 macros that reuse arguments in Include (including subdirectories):
macros-that-reuse-args.txt
I'm closing this until there's some consensus regarding bpo-43502.