Should `Py_Is` be preferred to `==`?

I consider Py_Is deadborn, like iso646.h macros or trigraphs. A change which makes Py_Is and == not equivalent will break not only CPython code, but every one Python extension. It will also likely require changing the assignment operation and comparison with NULL, so PyObject *x = foo() and if (x) will be needed to be rewritten with some new macros. This is such larger breaking change, that equivalent to rewriting all extensions from C to other programming language. It will kill Python ecosystem.

4 Likes