10000 gh-114563: C decimal falls back to pydecimal for unsupported format strings by belm0 · Pull Request #114879 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-114563: C decimal falls back to pydecimal for unsupported format strings #114879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 12, 2024
Prev Previous commit
Next Next commit
only override message string on ValueError
  • Loading branch information
belm0 committed Feb 10, 2024
commit feb746947d56c23fdceed389a21d35629419212f
2 changes: 1 addition & 1 deletion Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3397,7 +3397,7 @@ pydec_format(PyObject *dec, PyObject *fmt, decimal_state *state)
result = PyObject_Format(pydec, fmt);
Py_DECREF(pydec);

if (result == NULL) {
if (result == NULL && PyErr_ExceptionMatches(PyExc_ValueError)) {
/* Do not confuse users with the _pydecimal exception */
PyErr_Clear();
PyErr_SetString(PyExc_ValueError, "invalid format string");
Expand Down
0