
On 24. 11. 21 15:22, Victor Stinner wrote:
On Wed, Nov 24, 2021 at 10:59 AM Petr Viktorin <encukou@gmail.com> wrote:
Since this is about converting existing macros (and not writing new ones), can you talk about which of the "macro pitfalls" apply to the macros in CPython that were/will be changed?
The PEP 670 lists many pitfalls affecting existing macros. Some pitfalls are already worked around in the current implementations, but the point is that it's easy to miss pitfalls when reviewing code adding new macros or modifying macros.
Erlend did an analysis in: https://bugs.python.org/issue43502
For macros reusing arguments (known as "Duplication of side effects" in GCC Macro Pitfalls), see his list: https://bugs.python.org/file49877/macros-that-reuse-args.txt
That's s nice list. Could you link to it in the PEP, so the next person won't have to ask? Meanwhile, I think I found a major source of my confusion with the PEP: I'm not clear on what it actually proposes. Is it justification for changes that were already done, or a plan for more changes, or a policy change ("don't write a public macro if it can be a function"), or all of those?