[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Antoine Pitrou

New submission from Antoine Pitrou:

 def f(a, self): pass
... 
 sig = inspect.signature(f)
 sig.bind(1, 2)
inspect.BoundArguments object at 0x7f607ead1e28
 sig.bind(a=1, self=2)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: bind() got multiple values for argument 'self'

--
components: Library (Lib)
messages: 180906
nosy: larry, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: Signature.bind() fails with a keyword argument named self
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Yury Selivanov

Yury Selivanov added the comment:

I'll take a look later today.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file28900/sig_bind_self.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks Antoine, the patch looks good to me.

The only thing I would have done differently myself is to name self as 
__bind_self__ (with two underscores at the end).

Could you please apply the patch?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 49fd1c8aeca5 by Antoine Pitrou in branch '3.3':
Issue #17071: Signature.bind() now works when one of the keyword arguments is 
named ``self``.
http://hg.python.org/cpython/rev/49fd1c8aeca5

New changeset 4ff1dc8c0a3c by Antoine Pitrou in branch 'default':
Issue #17071: Signature.bind() now works when one of the keyword arguments is 
named self.
http://hg.python.org/cpython/rev/4ff1dc8c0a3c

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Committed to 3.3 and default!

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread STINNER Victor

STINNER Victor added the comment:

self doesn't need to have a name, you can use:

def bind(*args, **kw):
  self = args[0]
  args = args[1:]

To accept any name ;-)

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17071] Signature.bind() fails with a keyword argument named self

2013-01-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Indeed, there were several solutions to this.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com