Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-09-13 Thread INADA Naoki
2018年9月13日(木) 18:22 Jeroen Demeyer : > On 2018-09-13 02:26, Petr Viktorin wrote: > > > PyCCall_FASTCALL is not a macro, shouldn't it be named PyCCall_FastCall? > > What's the convention for that anyway? I assumed that capital letters > meant a "really know what you are doing" function which could

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-09-13 Thread Petr Viktorin
On 09/13/18 02:22, Jeroen Demeyer wrote: On 2018-09-13 02:26, Petr Viktorin wrote: The reference to PEP 573 is premature. It seems to me that PEP 580 helps with the use case of PEP 573. In fact, it implements part of what PEP 573 proposes. So I don't see the problem with the reference to PEP

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-09-13 Thread Jeroen Demeyer
On 2018-09-13 02:26, Petr Viktorin wrote: The reference to PEP 573 is premature. It seems to me that PEP 580 helps with the use case of PEP 573. In fact, it implements part of what PEP 573 proposes. So I don't see the problem with the reference to PEP 573. Even if the implementation of PEP 57

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-09-12 Thread Petr Viktorin
On 06/20/18 01:53, Jeroen Demeyer wrote: Hello, Let me present PEP 579 and PEP 580. PEP 579 is an informational meta-PEP, listing some of the issues with functions/methods implemented in C. The idea is to create several PEPs each fix some part of the issues mentioned in PEP 579. PEP 580 is

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-07-07 Thread Stefan Behnel
INADA Naoki schrieb am 07.07.2018 um 10:08: > Thank you. Do you plan to make it default when PEP 580 is accepted > and implemented? It will become the default at some point, I'm sure. Note that we will still have to support older Python versions, though, currently 2.6+, which would not have the i

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-07-07 Thread INADA Naoki
On Sat, Jul 7, 2018 at 4:35 PM Stefan Behnel wrote: > > INADA Naoki schrieb am 07.07.2018 um 06:10: > > How often "custom method type" are used? > > > > I thought Cython use it by default. > > But when I read code generated by Cython, I can't find it. > > It uses normal PyMethodDef and tp_methods.

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-07-07 Thread Stefan Behnel
INADA Naoki schrieb am 07.07.2018 um 06:10: > How often "custom method type" are used? > > I thought Cython use it by default. > But when I read code generated by Cython, I can't find it. > It uses normal PyMethodDef and tp_methods. > > I found CyFunction in Cython repository, but I can't find >

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-07-06 Thread INADA Naoki
How often "custom method type" are used? I thought Cython use it by default. But when I read code generated by Cython, I can't find it. It uses normal PyMethodDef and tp_methods. I found CyFunction in Cython repository, but I can't find how to use it. Cython document doesn't explain any informat

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-21 Thread Jeroen Demeyer
On 2018-06-21 11:22, Victor Stinner wrote: https://www.python.org/dev/peps/pep-0580/#the-c-call-protocol CCALL_VARARGS: cc_func(PyObject *self, PyObject *args) If we add a new calling convention This is not a *new* calling convention, it's the *existing* calling convention for METH_VARARGS.

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-21 Thread Victor Stinner
https://www.python.org/dev/peps/pep-0580/#the-c-call-protocol CCALL_VARARGS: cc_func(PyObject *self, PyObject *args) If we add a new calling convention, I would prefer to reuse the FASTCALL calling convention to pass arguments: pass a PyObject **args array with a size (Py_ssize_t nargs) rather th

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-20 Thread Jeroen Demeyer
On 2018-06-20 16:42, Antoine Pitrou wrote: I'm wondering what amount of code and debugging is needed for, say, Cython or Numba to implement that protocol as a caller, without going through the C API's indirections (for performance). The goal is to have a really fast C API without a lot of indir

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-20 Thread Antoine Pitrou
On Wed, 20 Jun 2018 16:32:09 +0200 Jeroen Demeyer wrote: > > > - there's CCALL_OBJCLASS and CCALL_SLICE_SELF which have, well, > >non-obvious behaviour (especially the latter), especially as it is > >conditioned on the value of other fields or flags > > It's actually quite obvious when

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-20 Thread Jeroen Demeyer
On 2018-06-20 16:09, Antoine Pitrou wrote: But there seems to be some complication on top of that: - PyCCall_FastCall() accepts several types for the keywords, even a dict; That is actually a *simplification* instead of a *complication*. Currently, there is a huge amount of code duplicatio

Re: [Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-20 Thread Antoine Pitrou
Hi Jeroen, On Wed, 20 Jun 2018 10:53:18 +0200 Jeroen Demeyer wrote: > > PEP 579 is an informational meta-PEP, listing some of the issues with > functions/methods implemented in C. The idea is to create several PEPs > each fix some part of the issues mentioned in PEP 579. > > PEP 580 is a st

[Python-Dev] PEP 579 and PEP 580: refactoring C functions and methods

2018-06-20 Thread Jeroen Demeyer
Hello, Let me present PEP 579 and PEP 580. PEP 579 is an informational meta-PEP, listing some of the issues with functions/methods implemented in C. The idea is to create several PEPs each fix some part of the issues mentioned in PEP 579. PEP 580 is a standards track PEP to introduce a new "