From: Benjamin Peterson Date: Thu, 2 Jan 2014 18:24:08 +0000 (-0600) Subject: avoid parameter name clash (closes #20108) X-Git-Tag: v3.4.0b2~47^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e6ab1715d13deab644e02e05d978ccb17241176;p=thirdparty%2FPython%2Fcpython.git avoid parameter name clash (closes #20108) --- diff --git a/Lib/inspect.py b/Lib/inspect.py index 9337bd590b90..680623d9b4ab 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -985,12 +985,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 f1e27c3dc129..7863b468da98 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -29,6 +29,8 @@ Core and Builtins 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.