Author taleinat
Recipients larry, taleinat
Date 2014-01-24.21:35:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390599341.47.0.747419262521.issue20385@psf.upfronthosting.co.za>
In-reply-to
Content
To quote issue20294 where Larry Hastings added AC support for __new__ and __init__:

"
* __init__ and __new__ always take kwargs.
  * if the function signature doesn't accept keyword arguments,
    it calls _PyArg_NoKeywords().
"

However, due to issue1486663, many classes only do a _PyArg_NoKeywords if the type is the original class, but not for sub-classses. Examples are _random.Random (in which case I found a workaround) and many itertools classes, for which there are also tests that check this.

One possibility is to simply allow these classes to also accept keyword arguments. It doesn't break backwards compatibility, and once there are proper argument names and doc-strings, why not?

Otherwise, currently I have to make generated __new__ functions accept keyword arguments, and then wrap them with a function that checks _PyArg_NoKeywords only if the the type is the original class.
History
Date User Action Args
2014-01-24 21:35:41taleinatsetrecipients: + taleinat, larry
2014-01-24 21:35:41taleinatsetmessageid: <1390599341.47.0.747419262521.issue20385@psf.upfronthosting.co.za>
2014-01-24 21:35:41taleinatlinkissue20385 messages
2014-01-24 21:35:40taleinatcreate