[issue43753] [C API] Add Py_IS(x, y) macro

2021-04-06 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +23964 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25227 ___ Python tracker ___ _

[issue43753] [C API] Add Py_IS(x, y) macro

2021-04-06 Thread STINNER Victor
STINNER Victor added the comment: Python has more singletons. In C: * Py_NotImplemented: NotImplemented * Py_Ellipsis: Ellipsis But I don't think that "x == NotImplemented" is common enough to justify a new function. -- ___ Python tracker

[issue43753] [C API] Add Py_IS(x, y) macro

2021-04-06 Thread STINNER Victor
New submission from STINNER Victor : I propose to add at least Py_Is(x, y) function to the Python C API which would be simply implemented as: static inline int Py_Is(PyObject *x, PyObject *y) { return (x == y); } Right now, there is no benefit for CPython. The idea is to prepare the CPyth