|
101 | 101 | #endif
|
102 | 102 |
|
103 | 103 | #if defined(RANDALL_WAS_HERE)
|
104 |
| -#define Py_UNREACHABLE() do { \ |
105 |
| - fputs( \ |
106 |
| - "ERROR:\n\n" \ |
107 |
| - "If you're seeing this, the code is in what I thought was\n" \ |
108 |
| - "an unreachable state.\n\n" \ |
109 |
| - "I could give you advice for what to do, but honestly, why\n" \ |
110 |
| - "should you trust me? I clearly screwed this up. I'm writing\n" \ |
111 |
| - "a message that should never appear, yet I know it will\n" \ |
112 |
| - "probably appear someday.\n\n" \ |
113 |
| - "On a deep level, I know I'm not up to this task.\n" \ |
114 |
| - "I'm so sorry.\n\n" \ |
115 |
| - "https://xkcd.com/2200\n", stderr); \ |
116 |
| - abort(); \ |
117 |
| - } while(0) |
| 104 | +#define Py_UNREACHABLE() \ |
| 105 | + Py_FatalError( \ |
| 106 | + "If you're seeing this, the code is in what I thought was\n" \ |
| 107 | + "an unreachable state.\n\n" \ |
| 108 | + "I could give you advice for what to do, but honestly, why\n" \ |
| 109 | + "should you trust me? I clearly screwed this up. I'm writing\n" \ |
| 110 | + "a message that should never appear, yet I know it will\n" \ |
| 111 | + "probably appear someday.\n\n" \ |
| 112 | + "On a deep level, I know I'm not up to this task.\n" \ |
| 113 | + "I'm so sorry.\n" \ |
| 114 | + "https://xkcd.com/2200") |
118 | 115 | #elif defined(Py_DEBUG)
|
119 |
| -#define Py_UNREACHABLE() do { \ |
120 |
| - fputs( \ |
121 |
| - "ERROR:\n\n" \ |
122 |
| - "We've reached an unreachable state. Anything is possible.\n" \ |
123 |
| - "The limits were in our heads all along. Follow your dreams.\n\n" \ |
124 |
| - "https://xkcd.com/2200\n", stderr); \ |
125 |
| - abort(); \ |
126 |
| - } while(0) |
| 116 | +#define Py_UNREACHABLE() \ |
| 117 | + Py_FatalError( \ |
| 118 | + "We've reached an unreachable state. Anything is possible.\n" \ |
| 119 | + "The limits were in our heads all along. Follow your dreams.\n" \ |
| 120 | + "https://xkcd.com/2200") |
127 | 121 | #else
|
128 |
| -#define Py_UNREACHABLE() abort() |
| 122 | +#define Py_UNREACHABLE() \ |
| 123 | + Py_FatalError("Unreachable C code path reached") |
129 | 124 | #endif
|
130 | 125 |
|
131 | 126 | #endif /* Py_PYMACRO_H */
|
0 commit comments