diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-18 16:39:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 16:39:48 (GMT) |
commit | 04394df74b3d0783893da7dafa7803a003516402 (patch) | |
tree | 0b3febf63a8ae95b3094b14f43a0bfa268b15b93 | |
parent | f49f6baa6bf7916ac039194c24b59d2eff5b180a (diff) | |
download | cpython-04394df74b3d0783893da7dafa7803a003516402.zip cpython-04394df74b3d0783893da7dafa7803a003516402.tar.gz cpython-04394df74b3d0783893da7dafa7803a003516402.tar.bz2 |
bpo-38631: Avoid Py_FatalError() in float.__getformat__() (GH-17232)
Replace Py_FatalError() with a regular RuntimeError exception in
float.__getformat__().
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst | 2 | ||||
-rw-r--r-- | Objects/floatobject.c | 3 |
2 files changed, 4 insertions, 1 deletions
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 index 0000000..d05ad05 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst @@ -0,0 +1,2 @@ +Replace ``Py_FatalError()`` call with a regular :exc:`RuntimeError` +exception in :meth:`float.__getformat__`. diff --git a/Objects/floatobject.c b/Objects/floatobject.c index 8c08866..3f9bbde 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -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; } } |