Skip to content

Commit 04394df

Browse files
authored
bpo-38631: Avoid Py_FatalError() in float.__getformat__() (GH-17232)
Replace Py_FatalError() with a regular RuntimeError exception in float.__getformat__().
1 parent f49f6ba commit 04394df

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Replace ``Py_FatalError()`` call with a regular :exc:`RuntimeError`
2+
exception in :meth:`float.__getformat__`.

Objects/floatobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,8 @@ float___getformat___impl(PyTypeObject *type, const char *typestr)
17261726
case ieee_big_endian_format:
17271727
return PyUnicode_FromString("IEEE, big-endian");
17281728
default:
1729-
Py_FatalError("insane float_format or double_format");
1729+
PyErr_SetString(PyExc_RuntimeError,
1730+
"insane float_format or double_format");
17301731
return NULL;
17311732
}
17321733
}

0 commit comments

Comments
 (0)