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

2022-02-21 Thread Victor Stinner
Well, maybe it's a bad example. I just wanted to say that converting macros to static inline functions provide more accurate profiler data and debuggers can more easily show static inline functions names when they are inlined and put breakpoints of them. But you're right, it's not a silver bullet

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

2022-02-14 Thread Antoine Pitrou
On Wed, 9 Feb 2022 17:49:19 +0100 Victor Stinner wrote: > On Wed, Feb 9, 2022 at 1:04 PM Petr Viktorin wrote: > > > Right now, a large number of macros cast their argument to a type. A > > > few examples: > > > > > > #define PyObject_TypeCheck(ob, type) > > >

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

2022-02-10 Thread Victor Stinner
On Thu, Feb 10, 2022 at 10:58 AM Petr Viktorin wrote: > > On 09. 02. 22 21:41, Gregory P. Smith wrote: > > > > On Wed, Feb 9, 2022 at 8:54 AM Victor Stinner > Perhaps use a hybrid approach > > when feasible similar to: > >#define PyUnicode_CHECK_INTERNED(op) > >

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

2022-02-10 Thread Petr Viktorin
On 09. 02. 22 21:41, Gregory P. Smith wrote: On Wed, Feb 9, 2022 at 8:54 AM Victor Stinner [...] Two differing examples from that PR 31221: Hold off as unsafe for now: Macros that do things like (PyWhateverObject*)(op) such as PyUnicode_CHECK_INTERNED(op) should not have the casting part

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

2022-02-09 Thread Gregory P. Smith
On Wed, Feb 9, 2022 at 8:54 AM Victor Stinner wrote: > On Wed, Feb 9, 2022 at 1:04 PM Petr Viktorin wrote: > > > Right now, a large number of macros cast their argument to a type. A > > > few examples: > > > > > > #define PyObject_TypeCheck(ob, type) > > > PyObject_TypeCheck(_PyObject_CAST(ob),

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

2022-02-09 Thread Victor Stinner
On Wed, Feb 9, 2022 at 1:04 PM Petr Viktorin wrote: > > Right now, a large number of macros cast their argument to a type. A > > few examples: > > > > #define PyObject_TypeCheck(ob, type) > > PyObject_TypeCheck(_PyObject_CAST(ob), type) > > #define PyTuple_GET_ITEM(op, i)

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

2022-02-09 Thread Petr Viktorin
On 08. 02. 22 12:07, Erlend Aasland wrote: Petr, SC, thanks for your time and response! Just a quick comment: On 8 Feb 2022, at 11:32, Petr Viktorin wrote: In effect, the SC accepts the first part of the PEP, except cases where: What status does that put the PEP in? Still draft. It's

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

2022-02-09 Thread Petr Viktorin
On 08. 02. 22 17:27, Victor Stinner wrote: Hi Petr, Thanks for the SC review, it's very helpful! I know that it's a big PEP :-) On Tue, Feb 8, 2022 at 11:33 AM Petr Viktorin wrote: *All other things being equal, static inline functions are better than macros.* Specifically, inline static

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

2022-02-08 Thread Brett Cannon
On Tue, Feb 8, 2022 at 8:30 AM Victor Stinner wrote: > Hi Petr, > > Thanks for the SC review, it's very helpful! I know that it's a big PEP :-) > > On Tue, Feb 8, 2022 at 11:33 AM Petr Viktorin wrote: > > *All other things being equal, static inline functions are better than > > macros.* > >

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

2022-02-08 Thread Victor Stinner
Hi Petr, Thanks for the SC review, it's very helpful! I know that it's a big PEP :-) On Tue, Feb 8, 2022 at 11:33 AM Petr Viktorin wrote: > *All other things being equal, static inline functions are better than > macros.* > Specifically, inline static functions should be preferred over >

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

2022-02-08 Thread Erlend Aasland
Petr, SC, thanks for your time and response! Just a quick comment: > On 8 Feb 2022, at 11:32, Petr Viktorin wrote: > > In effect, the SC accepts the first part of the PEP, except cases where: What status does that put the PEP in? E ___ Python-Dev