This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SylvainDe
Recipients SylvainDe, larry
Date 2017-03-27.20:55:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490648122.87.0.778103510722.issue29924@psf.upfronthosting.co.za>
In-reply-to
Content
Very uninteresting issue I've found while looking at the code.

In Objects/call.c, in _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **arg...), we have


   no_keyword_error:
       PyErr_Format(PyExc_TypeError,
                    "%.200s() takes no keyword arguments",
                    method->ml_name, nargs);

The `nargs` seems pointless.

This issue is mosly opened to have a record number to open a commit but it raises a few questions:

 - would it make sense to try to use GCC/CLang's logic around __attribute__ to have this kind of things checked during compilation as much as possible ?

 - would it make sense to define very small functions wrapping some calls to `PyErr_Format` so that one can use function with a very clear signature at (almost) no cost? This would be specially relevant for error raised in multiple places with the same message (The trio PyMethodDef *method/PyExc_TypeError/"%.200s() takes no keyword arguments" is a good candidate for this). I'd be happy for work on this but I'm afraid this would correspond to something Raymond Hettinger asks new comers not to do : "Don't be a picture straightener" ( https://speakerdeck.com/pybay2016/raymond-hettinger-keynote-core-developer-world ).

I've filled the impacted version as 3.7 as there is no real impacted version from a user point of view.
History
Date User Action Args
2017-03-27 20:55:22SylvainDesetrecipients: + SylvainDe, larry
2017-03-27 20:55:22SylvainDesetmessageid: <1490648122.87.0.778103510722.issue29924@psf.upfronthosting.co.za>
2017-03-27 20:55:22SylvainDelinkissue29924 messages
2017-03-27 20:55:22SylvainDecreate