bpo-31338 by warsaw · Pull Request #3374 · python/cpython (original) (raw)

Over in http://bugs.python.org/issue31338 the idea to implement a macro called Py_UNREACHABLE() was proposed. This would be used in cases where you'd be tempted to use an assert(0) or abort(), i.e. for code paths you do not expect will ever be reached.

Using Py_UNREACHABLE() has a few advantages:

I've changed the examples described in bpo-31338, but may not have gotten them all.

For now, this is defined strictly as abort() which is the simplest thing that make the common compilers happy.

I've also added some documentation about Py_UNREACHABLE() and a few other macros in pymacros.h.

https://bugs.python.org/issue31338