[Python-checkins] cpython (3.3): avoid parameter name clash (closes #20108)

benjamin.peterson python-checkins at python.org
Thu Jan 2 19:27:07 CET 2014


http://hg.python.org/cpython/rev/b0d472e3ff42
changeset:   88257:b0d472e3ff42
branch:      3.3
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Jan 02 12:24:08 2014 -0600
summary:
  avoid parameter name clash (closes #20108)

files:
  Lib/inspect.py |  4 +++-
  Misc/NEWS      |  2 ++
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/inspect.py b/Lib/inspect.py
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -985,12 +985,14 @@
             (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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -29,6 +29,8 @@
 Library
 -------
 
+- Issue #20108: Avoid parameter name clash in inspect.getcallargs().
+
 - Issue #12692: Backport the fix for ResourceWarning in test_urllib2net. This
   also helps in closing the socket when Connection Close header is not sent.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list