class BadConstructorArgs(unittest.TestCase):
def test_bad_EG_construction__too_many_args(self):
- MSG = 'function takes exactly 2 arguments'
+ MSG = 'BaseExceptionGroup.__new__\(\) takes exactly 2 arguments'
with self.assertRaisesRegex(TypeError, MSG):
ExceptionGroup('no errors')
with self.assertRaisesRegex(TypeError, MSG):
--- /dev/null
+Improve error message on invalid calls to :meth:`BaseExceptionGroup.__new__`.
\ No newline at end of file
PyObject *message = NULL;
PyObject *exceptions = NULL;
- if (!PyArg_ParseTuple(args, "UO", &message, &exceptions)) {
+ if (!PyArg_ParseTuple(args,
+ "UO:BaseExceptionGroup.__new__",
+ &message,
+ &exceptions)) {
return NULL;
}