[Python-checkins] bpo-38205: Py_UNREACHABLE() calls Py_FatalError() (GH-16290) (GH-16306)

Victor Stinner webhook-mailer at python.org
Fri Sep 20 17:36:36 EDT 2019


https://github.com/python/cpython/commit/245d439320e0921459502883fe809213e3b93e35
commit: 245d439320e0921459502883fe809213e3b93e35
branch: 3.8
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-09-20T23:36:32+02:00
summary:

bpo-38205: Py_UNREACHABLE() calls Py_FatalError() (GH-16290) (GH-16306)

(cherry picked from commit b1542583bee204130934c2b90684041e29378250)

files:
A Misc/NEWS.d/next/C API/2019-09-19-18-26-29.bpo-38205.Db1OJL.rst
M Include/pymacro.h

diff --git a/Include/pymacro.h b/Include/pymacro.h
index 1890619099a3..495c2c25c908 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -100,6 +100,7 @@
 #  define Py_UNUSED(name) _unused_ ## name
 #endif
 
-#define Py_UNREACHABLE() abort()
+#define Py_UNREACHABLE() \
+    Py_FatalError("Unreachable C code path reached")
 
 #endif /* Py_PYMACRO_H */
diff --git a/Misc/NEWS.d/next/C API/2019-09-19-18-26-29.bpo-38205.Db1OJL.rst b/Misc/NEWS.d/next/C API/2019-09-19-18-26-29.bpo-38205.Db1OJL.rst
new file mode 100644
index 000000000000..1818e54d461a
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2019-09-19-18-26-29.bpo-38205.Db1OJL.rst	
@@ -0,0 +1 @@
+The :c:func:`Py_UNREACHABLE` macro now calls :c:func:`Py_FatalError`.



More information about the Python-checkins mailing list