]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38631: Avoid Py_FatalError() in float.__getformat__() (GH-17232)
authorVictor Stinner <vstinner@python.org>
Mon, 18 Nov 2019 16:39:48 +0000 (17:39 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Nov 2019 16:39:48 +0000 (17:39 +0100)
Replace Py_FatalError() with a regular RuntimeError exception in
float.__getformat__().

Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst [new file with mode: 0644]
Objects/floatobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst
new file mode 100644 (file)
index 0000000..d05ad05
--- /dev/null
@@ -0,0 +1,2 @@
+Replace ``Py_FatalError()`` call with a regular :exc:`RuntimeError`
+exception in :meth:`float.__getformat__`.
index 8c08866d73725304d373dc0a42b207f402f5462f..3f9bbde2abe03f539b95a1fd809bad7c6375d882 100644 (file)
@@ -1726,7 +1726,8 @@ float___getformat___impl(PyTypeObject *type, const char *typestr)
     case ieee_big_endian_format:
         return PyUnicode_FromString("IEEE, big-endian");
     default:
-        Py_FatalError("insane float_format or double_format");
+        PyErr_SetString(PyExc_RuntimeError,
+                        "insane float_format or double_format");
         return NULL;
     }
 }