summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/inspect.py2
-rw-r--r--Lib/test/test_inspect.py6
2 files changed, 7 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 06057af..9f9a600 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1125,7 +1125,7 @@ def _missing_arguments(f_name, argnames, pos, values):
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" %
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 20f7217..38367f3 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -1214,6 +1214,12 @@ class TestGetcallargsFunctions(unittest.TestCase):
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):