19.11.17 12:59, Antoine Pitrou пише: > On Sun, 19 Nov 2017 00:18:28 +0100 > Victor Stinner <victor.stinner at gmail.com> wrote: >> Le 18 nov. 2017 10:44, "Serhiy Storchaka" <storchaka at gmail.com> 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 :-) > > But those do not have the same semantics. PyTuple_GetItem() checks its > arguments and raises an error if you pass it something else than a > tuple, or if the index is out of bounds. PyTuple_GET_ITEM(), however, > will crash if you do so. There are no guaranties that PyTuple_GET_ITEM() will crash. In all cases when PyTuple_GET_ITEM() is used for getting the reference to a tuple's item it can be replaced with PyTuple_GetItem(). 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 = &PyTuple_GET_ITEM(tuple, 0);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4