Created on 2017-03-27 20:55 by SylvainDe, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests |
|
|
|
URL |
Status |
Linked |
Edit |
PR 854 |
merged |
python-dev,2017-03-27 21:03 |
|
Messages (7) |
|
|
msg290645 - (view) |
Author: SylvainDe (SylvainDe) * |
Date: 2017-03-27 20:55 |
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. |
|
|
msg290648 - (view) |
Author: SylvainDe (SylvainDe) * |
Date: 2017-03-27 20:57 |
I forgot to copy the link but here is a description of what I had in mind for the first idea. |
|
|
msg290649 - (view) |
Author: SylvainDe (SylvainDe) * |
Date: 2017-03-27 20:58 |
http://julio.meroh.net/2011/06/validating-format-strings-in-custom-c.html |
|
|
msg290654 - (view) |
Author: Larry Hastings (larry) *  |
Date: 2017-03-27 21:16 |
This is not an Argument Clinic issue. |
|
|
msg290657 - (view) |
Author: SylvainDe (SylvainDe) * |
Date: 2017-03-27 21:26 |
Seems to be introduced via 250e4b0063fab35770719b64d1e36209c4aa2596 in January this year. |
|
|
msg290659 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-03-27 21:36 |
New changeset d67a103702cf57de90a62c90f7ae969c23d96218 by Victor Stinner (Sylvain) in branch 'master': bpo-29924: Remove useless argument (#854) https://github.com/python/cpython/commit/d67a103702cf57de90a62c90f7ae969c23d96218 |
|
|
msg290660 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-03-27 21:40 |
Thank you SylvainDe, I merged your fix! About the GCC __attribute__ idea: I'm not sure, since Python uses some extra formatters (I don't recall which one). If you succeed to write something working, please open a new issue! Since the initial bug is fixed, I close the issue now. |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:44 |
admin |
set |
github: 74110 |
2017-03-27 21:40:03 |
vstinner |
set |
status: open -> closedresolution: fixedmessages: + stage: resolved |
2017-03-27 21:36:10 |
vstinner |
set |
nosy: + vstinnermessages: + |
2017-03-27 21:26:42 |
SylvainDe |
set |
messages: + |
2017-03-27 21:16:13 |
larry |
set |
nosy: - larry |
2017-03-27 21:16:00 |
larry |
set |
nosy:larry, SylvainDemessages: + components: + Interpreter Core, - Argument Clinic |
2017-03-27 21:03:39 |
python-dev |
set |
pull_requests: + <pull%5Frequest755> |
2017-03-27 20:58:26 |
SylvainDe |
set |
messages: + |
2017-03-27 20:57:54 |
SylvainDe |
set |
messages: + |
2017-03-27 20:55:22 |
SylvainDe |
create |
|