Issue 37034: Argument Clinic omits name of keyword-only parameter on _PyArg_BadArgument() call (original) (raw)

Created on 2019-05-24 10:29 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13593 merged remi.lapeyre,2019-05-27 14:13
PR 15599 merged serhiy.storchaka,2019-08-29 15:09
Messages (8)
msg343365 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-05-24 10:29
Example of generated code: if (!PyBytes_Check(args[15])) { _PyArg_BadArgument("replace", 16, "bytes", args[15]); goto exit; } Error message: TypeError: replace() argument 16 must be bytes, not tuple It is the 'lnotab' parameter which is a keywoard-only parameter. I expect the parameter name in the error message. Note: I got this error while implementing bpo-37032.
msg343629 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-05-27 14:15
With the attached PR, the error message is now: >>> def f(): pass ... >>> code = f.__code__ >>> code.replace(co_lnotab=4) Traceback (most recent call last): File "", line 1, in TypeError: replace() argument 'co_lnotab' must be bytes, not int
msg344700 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-06-05 10:31
This is a bug. I intentionally committed the simpler code, but forgot to fix it later.
msg344708 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-05 11:54
> This is a bug. I intentionally committed the simpler code, but forgot to fix it later. I suggest to also apply the fix to 3.8 in that case.
msg350787 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-08-29 14:49
New changeset 4901fe274bc82b95dc89bcb3de8802a3dfedab32 by Serhiy Storchaka (Rémi Lapeyre) in branch 'master': bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593) https://github.com/python/cpython/commit/4901fe274bc82b95dc89bcb3de8802a3dfedab32
msg350791 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-08-29 15:30
New changeset 96631dcb11c2786f470d4586bf23ecca14361506 by Serhiy Storchaka in branch '3.8': [3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599) https://github.com/python/cpython/commit/96631dcb11c2786f470d4586bf23ecca14361506
msg350793 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-08-29 15:52
Thank you Rémi!
msg350799 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-08-29 16:37
Thanks, that's a great enhancement!
History
Date User Action Args
2022-04-11 14:59:15 admin set github: 81215
2019-08-29 16:37:39 vstinner set messages: +
2019-08-29 15:52:22 serhiy.storchaka set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2019-08-29 15:30:02 serhiy.storchaka set messages: +
2019-08-29 15:09:52 serhiy.storchaka set pull_requests: + <pull%5Frequest15275>
2019-08-29 14:49:12 serhiy.storchaka set messages: +
2019-06-05 11:54:27 vstinner set messages: +
2019-06-05 10:31:04 serhiy.storchaka set type: behaviormessages: + versions: + Python 3.9
2019-05-27 14:15:47 remi.lapeyre set nosy: + remi.lapeyremessages: +
2019-05-27 14:13:42 remi.lapeyre set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest13500>
2019-05-24 10:29:45 vstinner create