Author terry.reedy
Recipients georg.brandl, python-dev, serhiy.storchaka, terry.reedy
Date 2015-03-24.21:28:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427232507.38.0.735840532996.issue23671@psf.upfronthosting.co.za>
In-reply-to
Content
This is a nice catch of a subtle bug and a nice fix.  I verified that replacing 'self' with '*args' does not simply shift the problem from 'self' to 'args'.

>>> class C:
	def test(*args, **kwargs):
		print(args, kwargs )
	
>>> c = C()
>>> c.test(1, args=2, kwargs=3, self=4)
(<__main__.C object at 0x00000000035FE128>, 1) {'args': 2, 'kwargs': 3, 'self': 4}

While the * and ** names are, like parameter names, local names given in the signature header, they are not counted as parameter names in the code object .co_argcount or .co_kwonlyargcount attributes that are used along with co_varnames in the name-argument matching process.
History
Date User Action Args
2015-03-24 21:28:27terry.reedysetrecipients: + terry.reedy, georg.brandl, python-dev, serhiy.storchaka
2015-03-24 21:28:27terry.reedysetmessageid: <1427232507.38.0.735840532996.issue23671@psf.upfronthosting.co.za>
2015-03-24 21:28:27terry.reedylinkissue23671 messages
2015-03-24 21:28:27terry.reedycreate