[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Guido van Rossum
Brandt looked at coz for Python but it didn't seem to find anything useful -- it singled out random lines in the code. :-( On Wed, Nov 24, 2021 at 10:13 AM Terry Reedy wrote: > On 11/23/2021 6:21 PM, Guido van Rossum wrote: > > > Thanks Antoine. We definitely need to push back on such

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Terry Reedy
On 11/23/2021 6:21 PM, Guido van Rossum wrote: Thanks Antoine. We definitely need to push back on such "expectations" and turn them into facts by performing careful measurements. Surprises lurk everywhere. See e.g. https://github.com/faster-cpython/ideas/issues/109#issuecomment-975619113

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Victor Stinner
I ran the Python test suite to compare macros versus static inline functions (using PR 29728). I built Python with gcc -O3, LTO and PGO optimizations. => There is *no* significant performance difference. I understand that static inline functions are inlined by the C compiler (GCC) as expected.

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Petr Viktorin
On 24. 11. 21 15:32, Victor Stinner wrote: On Wed, Nov 24, 2021 at 2:18 PM Petr Viktorin wrote: The "Backwards Compatibility" section is very small. Can you give a list of macros which lost/will lose "return values"? https://bugs.python.org/issue45476 lists many of them. See also:

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Petr Viktorin
On 24. 11. 21 15:22, Victor Stinner wrote: On Wed, Nov 24, 2021 at 10:59 AM Petr Viktorin 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

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Victor Stinner
On Wed, Nov 24, 2021 at 2:18 PM Petr Viktorin wrote: > >> The "Backwards Compatibility" section is very small. Can you give a list > >> of macros which lost/will lose "return values"? > > > > https://bugs.python.org/issue45476 lists many of them. See also: > >

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Victor Stinner
On Wed, Nov 24, 2021 at 10:59 AM Petr Viktorin 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

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Petr Viktorin
On 24. 11. 21 13:20, Victor Stinner wrote: On Wed, Nov 24, 2021 at 10:59 AM Petr Viktorin wrote: Are there more macros that are yet to be converted to macros, I suppose that you mean "to be converted to functions". Yes, there are many, it's the purpose of the PEP. I didn't provide a list.

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Victor Stinner
On Wed, Nov 24, 2021 at 10:59 AM Petr Viktorin wrote: > Are there more macros that are yet to be converted to macros, I suppose that you mean "to be converted to functions". Yes, there are many, it's the purpose of the PEP. I didn't provide a list. I would prefer to do it on a case by case

[Python-Dev] Re: PEP 670: Convert macros to functions in the Python C API

2021-11-24 Thread Petr Viktorin
On 23. 11. 21 18:00, Victor Stinner wrote: I completed the PEP: https://python.github.io/peps/pep-0670/ What I don't like about this PEP is that it documents changes that were already pushed, not planned ones. But, what's done is done... Are there more macros that are yet to be converted to