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.

Title: Incorrect error message for a few functions called with keywod argument
Type: behavior Stage: resolved
Components: Extension Modules, Interpreter Core Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: SylvainDe, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-06-10 23:06 by SylvainDe, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2115 merged SylvainDe, 2017-06-15 15:07
Messages (3)
msg295676 - (view) Author: SylvainDe (SylvainDe) * Date: 2017-06-10 23:06
Follow-up for which is itself a follow-up for . Not quite sure what the process is in that situation : creating a new ticket or updating the old one ?

After working on , I thought that maybe other functions not generated by the clinic would have the same issue. "git grep _PyArg_NoStackKeywords | grep -v clinic" gave me some place to look for and indeed:

Modules/_struct.c:    if (!_PyArg_NoStackKeywords("pack", kwnames)) {
Modules/_struct.c:    if (!_PyArg_NoStackKeywords("pack_into", kwnames)) {
Python/bltinmodule.c:    if (!_PyArg_NoStackKeywords("getattr", kwnames)) {
Python/bltinmodule.c:    if (!_PyArg_NoStackKeywords("next", kwnames)) {

These four functions have a not-so-good error message when called with keyword arguments (and this is a regression compared to other Python versions)

I have a fix ready to be suggested but:

 - I want to be sure that I had to create a new ticket

 - I suspect functions defined via the GEN_CONSTRUCTOR macro in  Modules/_hashopenssl.c have the same issue but I do not know how to test it. Any help is welcome.
msg295677 - (view) Author: SylvainDe (SylvainDe) * Date: 2017-06-10 23:16
(Also, I suspect introspection could be used to know if the same bug is still lying somewhere: get all objects (using gc?), keep callables with no __code__ member only, call with keyword argument, check error.)
msg295686 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-11 03:57
Good catch SylvainDe!

You already opened a new ticked and old tickets are closed, so that let fix remaining issues here.

This issue is related to _PyArg_NoKeywords() and _PyArg_NoStackKeywords(), so it is enough to just check all usages of these functions. Most of them are in generated code and already fixed.

Tests for all these functions are not required.
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74812
2017-06-15 15:08:04serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2017-06-15 15:07:18SylvainDesetpull_requests: + pull_request2263
2017-06-11 03:57:10serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg295686

components: + Extension Modules
type: behavior
stage: needs patch
2017-06-10 23:16:16SylvainDesetmessages: + msg295677
2017-06-10 23:06:19SylvainDecreate