[New-bugs-announce] [issue20401] inspect.signature removes initial starred method params (bug)

Terry J. Reedy report at bugs.python.org
Mon Jan 27 03:16:33 CET 2014

New submission from Terry J. Reedy:

>>> import inspect
>>> class C:
	def meth(*args): pass
>>> str(inspect.signature(C.meth))
>>> c=C()
>>> str(s=inspect.signature(c.meth))

*args should have been left in even for the bound method, as idlelib calltips do.
Since '*' is not a word character,
idlelib.Calltips._first_param = re.compile('(?<=\()\w*\,?\s*')
does not see '*args' as a substring to be deleted with
    argspec = _first_param.sub("", argspec)

The same comment applies to
    def meth2(**kwds): pass
even though calling the bound method would fail.

messages: 209378
nosy: terry.reedy, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: inspect.signature removes initial starred method params (bug)
type: behavior
versions: Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list