summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/inspect.rst2
-rw-r--r--Lib/inspect.py4
-rw-r--r--Misc/NEWS2
3 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 41c61b7..4290aeb 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -753,7 +753,7 @@ Classes and functions
metatype is in use, cls will be the first element of the tuple.
-.. function:: getcallargs(func[, *args][, **kwds])
+.. function:: getcallargs(func, *args, **kwds)
Bind the *args* and *kwds* to the argument names of the Python function or
method *func*, as if it was called with them. For bound methods, bind also the
diff --git a/Lib/inspect.py b/Lib/inspect.py
index dc94e44..7c954eb 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1087,12 +1087,14 @@ def _too_many(f_name, args, kwonly, varargs, defcount, given, values):
(f_name, sig, "s" if plural else "", given, kwonly_sig,
"was" if given == 1 and not kwonly_given else "were"))
-def getcallargs(func, *positional, **named):
+def getcallargs(*func_and_positional, **named):
"""Get the mapping of arguments to values.
A dict is returned, with keys the function argument names (including the
names of the * and ** arguments, if any), and values the respective bound
values from 'positional' and 'named'."""
+ func = func_and_positional[0]
+ positional = func_and_positional[1:]
spec = getfullargspec(func)
args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = spec
f_name = func.__name__
diff --git a/Misc/NEWS b/Misc/NEWS
index 69f43b0..79509eb 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,8 @@ Library
- Fix breakage in TestSuite.countTestCases() introduced by issue #11798.
+- Issue #20108: Avoid parameter name clash in inspect.getcallargs().
+
- Issue #19918: Fix PurePath.relative_to() under Windows.
- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl