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:43:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583743382.43.0.0875918901595.issue38249@roundup.psfhosted.org>
In-reply-to
Content
The GCC documentation contains a good example:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

"""
Another use for __builtin_unreachable is following a call a function that never returns but that is not declared __attribute__((noreturn)), as in this example:

void function_that_never_returns (void);

int g (int c)
{
  if (c)
    {
      return 1;
    }
  else
    {
      function_that_never_returns ();
      __builtin_unreachable ();
    }
}
"""

This example is more explicit than a function which gets an "unexpected" value: such case should use Py_FatalError() if I understand correctly.

By the way, Py_FatalError() should be avoided: it's always better to report the failure to the caller :-)
History
Date User Action Args
2020-03-09 08:43:02vstinnersetrecipients: + vstinner, barry, pitrou, serhiy.storchaka
2020-03-09 08:43:02vstinnersetmessageid: <1583743382.43.0.0875918901595.issue38249@roundup.psfhosted.org>
2020-03-09 08:43:02vstinnerlinkissue38249 messages
2020-03-09 08:43:02vstinnercreate