diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-09-20 21:10:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 21:10:16 (GMT) |
commit | b1542583bee204130934c2b90684041e29378250 (patch) | |
tree | 9f0097a25870859d9a2d533b4d9e690c4485cf09 /Include/pymacro.h | |
parent | bc2256ea177a653bcab15b06b5f5725b10c1fff3 (diff) | |
download | cpython-b1542583bee204130934c2b90684041e29378250.zip cpython-b1542583bee204130934c2b90684041e29378250.tar.gz cpython-b1542583bee204130934c2b90684041e29378250.tar.bz2 |
bpo-38205: Py_UNREACHABLE() calls Py_FatalError() (GH-16290)
Diffstat (limited to 'Include/pymacro.h')
-rw-r--r-- | Include/pymacro.h | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h index ae09063..c080fb1 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -101,31 +101,26 @@ #endif #if defined(RANDALL_WAS_HERE) -#define Py_UNREACHABLE() do { \ - fputs( \ - "ERROR:\n\n" \ - "If you're seeing this, the code is in what I thought was\n" \ - "an unreachable state.\n\n" \ - "I could give you advice for what to do, but honestly, why\n" \ - "should you trust me? I clearly screwed this up. I'm writing\n" \ - "a message that should never appear, yet I know it will\n" \ - "probably appear someday.\n\n" \ - "On a deep level, I know I'm not up to this task.\n" \ - "I'm so sorry.\n\n" \ - "https://xkcd.com/2200\n", stderr); \ - abort(); \ - } while(0) +#define Py_UNREACHABLE() \ + Py_FatalError( \ + "If you're seeing this, the code is in what I thought was\n" \ + "an unreachable state.\n\n" \ + "I could give you advice for what to do, but honestly, why\n" \ + "should you trust me? I clearly screwed this up. I'm writing\n" \ + "a message that should never appear, yet I know it will\n" \ + "probably appear someday.\n\n" \ + "On a deep level, I know I'm not up to this task.\n" \ + "I'm so sorry.\n" \ + "https://xkcd.com/2200") #elif defined(Py_DEBUG) -#define Py_UNREACHABLE() do { \ - fputs( \ - "ERROR:\n\n" \ - "We've reached an unreachable state. Anything is possible.\n" \ - "The limits were in our heads all along. Follow your dreams.\n\n" \ - "https://xkcd.com/2200\n", stderr); \ - abort(); \ - } while(0) +#define Py_UNREACHABLE() \ + Py_FatalError( \ + "We've reached an unreachable state. Anything is possible.\n" \ + "The limits were in our heads all along. Follow your dreams.\n" \ + "https://xkcd.com/2200") #else -#define Py_UNREACHABLE() abort() +#define Py_UNREACHABLE() \ + Py_FatalError("Unreachable C code path reached") #endif #endif /* Py_PYMACRO_H */ |