◐ Shell
clean mode source ↗

bpo-38205: Py_UNREACHABLE() calls Py_FatalError() by vstinner · Pull Request #16290 · python/cpython

Example from:
#16280 (comment)

vstinner@apu$ ./python bug.py
Fatal Python error: We've reached an unreachable state. Anything is possible.
The limits were in our heads all along. Follow your dreams.
https://xkcd.com/2200
Python runtime state: initialized

Current thread 0x00007f5dc4f6d740 (most recent call first):
  File "/home/vstinner/python/master/bug.py", line 8 in func
  File "/home/vstinner/python/master/bug.py", line 11 in main
  File "/home/vstinner/python/master/bug.py", line 13 in <module>
Aborted (core dumped)

With RANDALL_WAS_HERE macro defined:

$ ./python bug.py
Fatal Python error: If you're seeing this, the code is in what I thought was
an unreachable state.

I could give you advice for what to do, but honestly, why
should you trust me?  I clearly screwed this up.  I'm writing
a message that should never appear, yet I know it will
probably appear someday.

On a deep level, I know I'm not up to this task.
I'm so sorry.
https://xkcd.com/2200
Python runtime state: initialized

Current thread 0x00007f7a71348740 (most recent call first):
  File "/home/vstinner/python/master/bug.py", line 8 in func
  File "/home/vstinner/python/master/bug.py", line 11 in main
  File "/home/vstinner/python/master/bug.py", line 13 in <module>
Aborted (core dumped)