Re: [Python-Dev] Make the stable API-ABI usable

2017-11-20 Thread Hrvoje Niksic
On 11/19/2017 12:50 PM, Serhiy Storchaka wrote: But if PyTuple_GET_ITEM() is used for getting a reference to a C array of items it can't be replaced with PyTuple_GetItem(). And actually there is no replacement for this case in the limited API. PyObject **items = _GET_ITEM(tuple, 0);

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-19 Thread Serhiy Storchaka
19.11.17 12:59, Antoine Pitrou пише: On Sun, 19 Nov 2017 00:18:28 +0100 Victor Stinner wrote: Le 18 nov. 2017 10:44, "Serhiy Storchaka" a écrit : The simplest way to do this: #define PyTuple_GET_ITEM PyTuple_GetItem This will not add new names

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-19 Thread Antoine Pitrou
On Sun, 19 Nov 2017 00:18:28 +0100 Victor Stinner wrote: > Le 18 nov. 2017 10:44, "Serhiy Storchaka" a écrit : > > The simplest way to do this: > > #define PyTuple_GET_ITEM PyTuple_GetItem > > This will not add new names to ABI. Such defines can

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Victor Stinner
Le 18 nov. 2017 10:44, "Serhiy Storchaka" a écrit : The simplest way to do this: #define PyTuple_GET_ITEM PyTuple_GetItem This will not add new names to ABI. Such defines can be added in a separate header file included for compatibility. It is exactly what I am proposing

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Koos Zevenhoven
Your email didn't compile. The compiler says that it's a naming conflict, but actually I think you forgot a semicolon! (Don't worry, it happens to all of us, whether we be happy or not :-) --Koos On Sat, Nov 18, 2017 at 3:05 AM, Victor Stinner wrote: > Hi, > > tl; dr

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Nick Coghlan
On 18 November 2017 at 23:50, Nick Coghlan wrote: > On 18 November 2017 at 11:05, Victor Stinner wrote: >> Hi, >> >> tl; dr I propose to extend the existing "stable API" to make it almost >> as complete as the current API. For example, add back >>

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Nick Coghlan
On 18 November 2017 at 11:05, Victor Stinner wrote: > Hi, > > tl; dr I propose to extend the existing "stable API" to make it almost > as complete as the current API. For example, add back > PyTuple_GET_ITEM() to be stable API, but it becomes a function call > rather

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Antoine Pitrou
On Sat, 18 Nov 2017 10:13:36 +0100 Victor Stinner wrote: > > Anyway, the PyTuple_GET_ITEM() will remain a macro in the default API for > Python 3.7. > > See also my blog post which explains why the fact that it is a macro > prevents us from optimizing it, like having

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Antoine Pitrou
I agree with Serhiy. It doesn't make sense to add PyTuple_GET_ITEM to the stable ABI. People who want to benefit from the stable ABI should use PyTuple_GetItem. That's not very complicated. Regards Antoine. On Sat, 18 Nov 2017 11:42:36 +0200 Serhiy Storchaka wrote: >

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Serhiy Storchaka
18.11.17 11:13, Victor Stinner пише: The idea behind adding PyTuple_GET_ITEM() is to be able to compile C extensions using it, without having to modify the code. The simplest way to do this: #define PyTuple_GET_ITEM PyTuple_GetItem This will not add new names to ABI. Such defines can be

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-18 Thread Victor Stinner
Le 18 nov. 2017 08:32, "Serhiy Storchaka" a écrit : Making PyTuple_GET_ITEM() a function will destroy the half of the benefit. And this will make the ABI larger. Sorry if I wasn't explicit about it: my idea of changing the API has an obvious impact on performance. That's

Re: [Python-Dev] Make the stable API-ABI usable

2017-11-17 Thread Serhiy Storchaka
18.11.17 03:05, Victor Stinner пише: tl; dr I propose to extend the existing "stable API" to make it almost as complete as the current API. For example, add back PyTuple_GET_ITEM() to be stable API, but it becomes a function call rather than a macro. The final question is if it's not too late to