Closed
Description
While looking at #87447 I've noticed that there are three places in cpython
where assert(0)
is used instead of Py_UNREACHABLE
macro:
Lines 1539 to 1542 in 984894a
As the docs say:
Use this when you have a code path that cannot be reached by design.
For example, in thedefault:
clause in aswitch
statement for which
all possible values are covered incase
statements. Use this in places
where you might be tempted to put anassert(0)
orabort()
call.
The intent with Py_UNREACHABLE
is clearer and error message is nicer.