Issue 23867: Argument Clinic: inline parsing code for 1-argument functions (original) (raw)

Created on 2015-04-04 14:24 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
clinic_meth_o_inline.patch serhiy.storchaka,2015-04-04 14:24 review
clinic_meth_o_inline.patch serhiy.storchaka,2016-05-01 13:53 review
Pull Requests
URL Status Linked Edit
PR 9689 merged serhiy.storchaka,2018-10-03 14:48
Messages (10)
msg240074 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-04-04 14:24
Proposed patch makes Argument Clinic to inline parsing code for most popular formats in functions with single positional argument. This makes parsing faster.
msg264596 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-01 13:53
Synchronized with tip.
msg264629 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2016-05-02 06:51
Why is this dependent on #26305?
msg264631 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-02 09:04
Because new generated code contains "if" statements and braces (and PEP 7 requires even more braces than current patch adds). The patch for allows to repeat braces only twice instead of 4 times.
msg286788 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-02-02 13:50
I like the idea since I just proposed something similar in the issue #29419, but it seems like your change removes the function name from error messages which can become much more obscure. Maybe we should wrap all exceptions into a new TypeError which contains at least the function name, or even the parameter name/position. I mean chained exception to keep the original exception which contains more information. The best would be to have all information in a single error message, but it is likely to be much more complex to implement, especially if you want to support arbitrary converter function, not only simple formats like i". So I think that two chained exceptions is a reasonable compromise. What do you think? If we succeed to get the function name and the parameter name or position, the error messages will be MUCH MORE better than currently! And Argument Clinic allows us to implement this feature.
msg326979 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-03 14:54
Thank you all for your comments. Addressed all comments, fixed few other bugs, added support for more convertors. I think this patch is completed. This is just a first step. Next steps are adding support of multiple positional-only parameters, optional groups, and finally keyword parameters.
msg327493 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-10 21:22
I'm a little bit sad that the PR doesn't add new tests :-(
msg332507 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-25 11:23
New changeset 32d96a2b5bc3136d45a66adbdb45fac351b520ce by Serhiy Storchaka in branch 'master': bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689) https://github.com/python/cpython/commit/32d96a2b5bc3136d45a66adbdb45fac351b520ce
msg332511 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-25 14:57
See for next step.
msg332978 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-01-04 13:52
Nice optimization! I wanted to implement it, but then I forgot.
History
Date User Action Args
2022-04-11 14:58:15 admin set github: 68055
2019-01-05 16:43:58 serhiy.storchaka link issue34838 dependencies
2019-01-04 13:52:43 vstinner set messages: +
2018-12-25 14:57:41 serhiy.storchaka set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2018-12-25 11:23:51 serhiy.storchaka set messages: +
2018-10-16 12:46:44 ammar2 set nosy: + ammar2
2018-10-10 21:22:23 vstinner set messages: +
2018-10-09 12:36:56 xtreak set nosy: + xtreak
2018-10-09 09:36:51 serhiy.storchaka set assignee: serhiy.storchaka
2018-10-03 14:54:13 serhiy.storchaka set messages: + versions: + Python 3.8, - Python 3.6
2018-10-03 14:48:53 serhiy.storchaka set stage: needs patch -> patch reviewpull_requests: + <pull%5Frequest9076>
2017-02-02 13:50:39 vstinner set nosy: + vstinnermessages: +
2016-06-09 12:23:06 serhiy.storchaka set stage: patch review -> needs patch
2016-05-02 09:04:09 serhiy.storchaka set messages: +
2016-05-02 06:51:20 larry set messages: +
2016-05-01 18:49:00 serhiy.storchaka set dependencies: + Make Argument Clinic to generate PEP 7 conforming code, Argument Clinic incorrectly works with custom converter and renamed parameter
2016-05-01 13:53:50 serhiy.storchaka set files: + clinic_meth_o_inline.patchmessages: + versions: + Python 3.6, - Python 3.5
2015-04-04 14:24:36 serhiy.storchaka create