File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Original file line number Diff line number Diff line change @@ -2536,7 +2536,7 @@ def test_exception_messages(self):
2536
2536
math .log (x )
2537
2537
x = - 123
2538
2538
with self .assertRaisesRegex (ValueError ,
2539
- f "expected a positive input, got { x } " ):
2539
+ "expected a positive input$ " ):
2540
2540
math .log (x )
2541
2541
with self .assertRaisesRegex (ValueError ,
2542
2542
f"expected a float or nonnegative integer, got { x } " ):
Original file line number Diff line number Diff line change @@ -2213,8 +2213,10 @@ loghelper(PyObject* arg, double (*func)(double))
2213
2213
2214
2214
/* Negative or zero inputs give a ValueError. */
2215
2215
if (!_PyLong_IsPositive ((PyLongObject * )arg )) {
2216
- PyErr_Format (PyExc_ValueError ,
2217
- "expected a positive input, got %S" , arg );
2216
+ /* The input can be an arbitrary large integer, so we
2217
+ don't include it's value in the error message. */
2218
+ PyErr_SetString (PyExc_ValueError ,
2219
+ "expected a positive input" );
2218
2220
return NULL ;
2219
2221
}
2220
2222
You can’t perform that action at this time.
0 commit comments