Patch by Jeremiah Lowin. Closes #20817.
elif missing == 2:
s = "{} and {}".format(*names)
else:
- tail = ", {} and {}".format(names[-2:])
+ tail = ", {} and {}".format(*names[-2:])
del names[-2:]
s = ", ".join(names) + tail
raise TypeError("%s() missing %i required %s argument%s: %s" %
inspect.getcallargs(f5)
+ # issue20817:
+ def f6(a, b, c):
+ pass
+ with self.assertRaisesRegex(TypeError, "'a', 'b' and 'c'"):
+ inspect.getcallargs(f6)
+
class TestGetcallargsMethods(TestGetcallargsFunctions):
def setUp(self):
- Issue #20816: Fix inspect.getcallargs() to raise correct TypeError for
missing keyword-only arguments. Patch by Jeremiah Lowin.
+- Issue #20817: Fix inspect.getcallargs() to fail correctly if more
+ than 3 arguments are missing. Patch by Jeremiah Lowin.
+
Documentation
-------------