gh-101409: Improve generated clinic code for self type checks by erlend-aasland · Pull Request #101411 · python/cpython
I'm not sure if this improvement is worth it, though; it may be churn for no benefit.
IMHO, this improvement is worth it.
-
If the
clinic_state()macro is fairly complicated, the compiler won't eliminate the redundant function invocations. -
The generated code after this patch is more concise and readable.
- If the
clinic_state()macro is fairly complicated, the compiler won't eliminate the redundant function invocations.
That is true; we cannot guarantee that the compiler will eliminate the redundant calls.
- The generated code after this patch is more concise and readable.
I agree with this.
Thanks for the review, @colorfulappl; highly appreciated.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self_tp may be not a good name. It is not a type of self. Maybe base_type or declared_type or something?
self_tpmay be not a good name. It is not a type ofself. Maybebase_typeordeclared_typeor something?
base_type sounds good; thanks!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM