Browse Source

bpo-38631: Avoid Py_FatalError() in float.__getformat__() (GH-17232)

Replace Py_FatalError() with a regular RuntimeError exception in
float.__getformat__().
pull/17240/head
Victor Stinner 6 years ago
committed by GitHub
parent
commit
04394df74b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Misc/NEWS.d/next/Core and Builtins/2019-11-18-17-10-20.bpo-38631.tRHaAk.rst
  2. 3
      Objects/floatobject.c

2
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__`.

3
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;
}
}

Loading…
Cancel
Save