homepage

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.

classification
Title: Argument Clinic: inline parsing code for 1-argument functions
Type: enhancement Stage: resolved
Components: Argument Clinic Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: 26305 26902 Superseder:
Assigned To: serhiy.storchaka Nosy List: ammar2, larry, serhiy.storchaka, vstinner, xtreak
Priority: normal Keywords: patch

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 issue26305 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 issue35582 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:15adminsetgithub: 68055
2019年01月05日 16:43:58serhiy.storchakalinkissue34838 dependencies
2019年01月04日 13:52:43vstinnersetmessages: + msg332978
2018年12月25日 14:57:41serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg332511

stage: patch review -> resolved
2018年12月25日 11:23:51serhiy.storchakasetmessages: + msg332507
2018年10月16日 12:46:44ammar2setnosy: + ammar2
2018年10月10日 21:22:23vstinnersetmessages: + msg327493
2018年10月09日 12:36:56xtreaksetnosy: + xtreak
2018年10月09日 09:36:51serhiy.storchakasetassignee: serhiy.storchaka
2018年10月03日 14:54:13serhiy.storchakasetmessages: + msg326979
versions: + Python 3.8, - Python 3.6
2018年10月03日 14:48:53serhiy.storchakasetstage: needs patch -> patch review
pull_requests: + pull_request9076
2017年02月02日 13:50:39vstinnersetnosy: + vstinner
messages: + msg286788
2016年06月09日 12:23:06serhiy.storchakasetstage: patch review -> needs patch
2016年05月02日 09:04:09serhiy.storchakasetmessages: + msg264631
2016年05月02日 06:51:20larrysetmessages: + msg264629
2016年05月01日 18:49:00serhiy.storchakasetdependencies: + Make Argument Clinic to generate PEP 7 conforming code, Argument Clinic incorrectly works with custom converter and renamed parameter
2016年05月01日 13:53:50serhiy.storchakasetfiles: + clinic_meth_o_inline.patch

messages: + msg264596
versions: + Python 3.6, - Python 3.5
2015年04月04日 14:24:36serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /