This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients barry, pitrou, serhiy.storchaka, vstinner
Date 2020-03-09.08:48:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Use this when you have a code path that cannot be reached by design. For example, in the default: clause in a switch statement for which all possible values are covered in case statements. Use this in places where you might be tempted to put an assert(0) or abort() call.

In release mode, the macro helps the compiler to optimize the code, and avoids a warning about unreachable code. For example, the macro is implemented with __builtin_unreachable() on GCC in release mode.

An use for Py_UNREACHABLE() is following a call a function that never returns but that is not declared _Py_NO_RETURN.

If a code path is very unlikely code but can be reached under exceptional case, this macro must not be used. For example, under low memory condition or if a system call returns a value out of the expected range. In this case, it's better to report the error to the caller. If the error cannot be reported to caller, :c:func:`Py_FatalError` can be used.
Date User Action Args
2020-03-09 08:48:04vstinnersetrecipients: + vstinner, barry, pitrou, serhiy.storchaka
2020-03-09 08:48:03vstinnersetmessageid: <>
2020-03-09 08:48:03vstinnerlinkissue38249 messages
2020-03-09 08:48:03vstinnercreate