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

Antoine Pitrou solipsis at pitrou.net
Sat Nov 18 06:38:48 EST 2017

On Sat, 18 Nov 2017 10:13:36 +0100
Victor Stinner <victor.stinner at gmail.com> 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 specialized compact tuple for
> small integers.

I'm not sure this would be an optimization.  You'll add checks to
PyTuple_GET_ITEM() to select the "kind" of tuple at runtime, and this
may very well make things slower.  You would need a JIT with type
constraints to remove the overhead and truly gain from the optimization.

Besides, PyTuple_GET_ITEM() can't really get any faster if all you care
about is the *objects* in the tuple, not their value.



More information about the Python-Dev mailing list