cpython: b19d76d9d2a7 (original) (raw)

--- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -943,8 +943,14 @@ def getcallargs(func, *positional, **nam f_name, 'at most' if defaults else 'exactly', num_args, 'arguments' if num_args > 1 else 'argument', num_total)) elif num_args == 0 and num_total:

--- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -632,6 +632,16 @@ class TestGetcallargsFunctions(unittest. self.assertEqualCallArgs(f, '2, c=4, **{u"b":3}') self.assertEqualCallArgs(f, 'b=2, **{u"a":3, u"c":4}')

+ def test_tupleargs(self): f = self.makeCallable('(b,c), (d,(e,f))=(0,[1,2])') self.assertEqualCallArgs(f, '(2,3)') @@ -693,6 +703,10 @@ class TestGetcallargsFunctions(unittest. self.assertEqualException(f, '1') self.assertEqualException(f, '[1]') self.assertEqualException(f, '(1,2,3)')

class TestGetcallargsMethods(TestGetcallargsFunctions):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,9 @@ Core and Builtins Library ------- +- Issue #11256: Fix inspect.getcallargs on functions that take only keyword