Commit c45873e4 authored by Yury Selivanov's avatar Yury Selivanov

inspect.Signature.bind: Update method signature to rule out possiblity

of name conflict between '__bind_self' and actual keyword argument to
'bind' or 'bind_partial'.
parent 421f0c7b
...@@ -2470,19 +2470,19 @@ class Signature: ...@@ -2470,19 +2470,19 @@ class Signature:
return self._bound_arguments_cls(self, arguments) return self._bound_arguments_cls(self, arguments)
def bind(__bind_self, *args, **kwargs): def bind(*args, **kwargs):
'''Get a BoundArguments object, that maps the passed `args` '''Get a BoundArguments object, that maps the passed `args`
and `kwargs` to the function's signature. Raises `TypeError` and `kwargs` to the function's signature. Raises `TypeError`
if the passed arguments can not be bound. if the passed arguments can not be bound.
''' '''
return __bind_self._bind(args, kwargs) return args[0]._bind(args[1:], kwargs)
def bind_partial(__bind_self, *args, **kwargs): def bind_partial(*args, **kwargs):
'''Get a BoundArguments object, that partially maps the '''Get a BoundArguments object, that partially maps the
passed `args` and `kwargs` to the function's signature. passed `args` and `kwargs` to the function's signature.
Raises `TypeError` if the passed arguments can not be bound. Raises `TypeError` if the passed arguments can not be bound.
''' '''
return __bind_self._bind(args, kwargs, partial=True) return args[0]._bind(args[1:], kwargs, partial=True)
def __str__(self): def __str__(self):
result = [] result = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment