[Python-checkins] cpython (merge 3.3 -> default): merge 3.3 (closes #20108)

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


http://hg.python.org/cpython/rev/c265675cd8e2
changeset: 88258:c265675cd8e2
parent: 88255:e2a1400b7db9
parent: 88257:b0d472e3ff42
user: Benjamin Peterson <benjamin at python.org>
date: Thu Jan 02 12:26:50 2014 -0600
summary:
 merge 3.3 (closes #20108)
files:
 Doc/library/inspect.rst | 2 +-
 Lib/inspect.py | 4 +++-
 Misc/NEWS | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -753,7 +753,7 @@
 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
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1087,12 +1087,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
@@ -46,6 +46,8 @@
 
 - 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
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /