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: Keep ASDL signatures for AST nodes
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, benjamin.peterson, pablogsal, serhiy.storchaka
Priority: low Keywords: patch

Created on 2020-02-15 11:32 by BTaskaya, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18515 merged BTaskaya, 2020-02-15 17:35
Messages (2)
msg362012 - (view) Author: Batuhan Taskaya (BTaskaya) * (Python committer) Date: 2020-02-15 11:32
It would be super convenient to keep ASDL declarations in AST nodes. There are multiple benefits of it;

1 -> When debugging or playing with the AST, time to time you may require to know what kind of things a field gets or is that field an optional one. 

2 -> The AST nodes are pretty limited on what can they do by default. For extending their scope, 3rd party tools often copy python's ASDL to their source and build custom AST nodes from that. And with knowing what every field gets they can automatically generate autotransformer codes from that ASDL spec which takes python's standard AST and convert it to their own AST nodes. 

We can either create a new attribute or keep this in the docstring. I think keeping this in the docstring can at least give some info about the node rather than None so it makes more sense to me. If the feature wanted, I can propose a PR.
msg364296 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-16 08:13
New changeset 4ab362cec6dc68c798b3e354f687cf39e207b9a9 by Batuhan Taşkaya in branch 'master':
bpo-39638: Keep ASDL signatures in the AST nodes (GH-18515)
https://github.com/python/cpython/commit/4ab362cec6dc68c798b3e354f687cf39e207b9a9
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83819
2020-03-16 08:21:03serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-16 08:13:16serhiy.storchakasetmessages: + msg364296
2020-03-08 09:42:12serhiy.storchakasetnosy: + serhiy.storchaka
2020-02-15 17:35:23BTaskayasetkeywords: + patch
stage: patch review
pull_requests: + pull_request17892
2020-02-15 11:32:26BTaskayacreate