git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] C API changes


On Thu, Nov 29, 2018 at 5:10 PM Armin Rigo <armin.rigo at gmail.com> wrote:
> PS: on CPython could use ``typedef struct { PyObject *_obj; }
> PyHandle;``.  This works like a pointer, but you can't use ``==`` to
> compare them.

And then you could have a macro or inline function to compare them,
simply by looking at that private member, and it should compile down
to the exact same machine code as comparing the original pointers
directly. It'd be a not-unreasonable migration path, should you want
to work that way - zero run-time cost.

ChrisA