mirror of https://github.com/python/cpython
merge 3.3 (closes #20108)
This commit is contained in:
commit
c22eaecd53
|
@ -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
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue