diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index c6560048325..9e19af0ae90 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1155,7 +1155,11 @@ class BuiltinTest(unittest.TestCase): max() self.assertRaises(TypeError, max, 42) - self.assertRaises(ValueError, max, ()) + with self.assertRaisesRegex( + ValueError, + r'max\(\) iterable argument is empty' + ): + max(()) class BadSeq: def __getitem__(self, index): raise ValueError @@ -1214,7 +1218,11 @@ class BuiltinTest(unittest.TestCase): min() self.assertRaises(TypeError, min, 42) - self.assertRaises(ValueError, min, ()) + with self.assertRaisesRegex( + ValueError, + r'min\(\) iterable argument is empty' + ): + min(()) class BadSeq: def __getitem__(self, index): raise ValueError diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 599cc18361a..f97dd67269a 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1814,7 +1814,7 @@ min_max(PyObject *args, PyObject *kwds, int op) maxitem = Py_NewRef(defaultval); } else { PyErr_Format(PyExc_ValueError, - "%s() arg is an empty sequence", name); + "%s() iterable argument is empty", name); } } else