Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-39981: Default values for AST nodes#19031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
isidentical commented Mar 16, 2020 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented Mar 16, 2020
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
pablogsal commented Mar 16, 2020
Some initial comments, without commenting on the approach itself. @serhiy-storchaka should confirm that he is happy with this approach as he was working on some related functionality. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Lib/ast.py Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this function. When we set the node_type._field_defaults we could already place None or [] in there instead of this intermediary "?" and "*".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think so, at least for lists. We are keeping _field_defaults as the same way we keep _fields, arrays of const char pointers. And then we construct a tuple from them and intern the values. I dont think it would be practical to do this with the original values.
pablogsalMar 17, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully understand the problem. What is wrong with having _field_defaults as a list of the defaults themselves? When constructing the _field_defaults tuple you can do this logic already and populate them with None or the empty list or whatever, no?
For instance, in the make_type function you could set the defaults in the tuple instead of interning the strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense. Do you have an idea about what we should put if there is no field default, I think Ellipsis should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need that if you use a dictionary instead of a tuple
isidentical commented Mar 17, 2020
I have made the requested changes; please review again |
bedevere-bot commented Mar 17, 2020
Thanks for making the requested changes! @pablogsal: please review the changes made to this pull request. |
9cdb15f to 0cbc2a8Compareisidentical commented Apr 22, 2020
@serhiy-storchaka It would be awesome to have your review / thoughts on this before alpha cut. |
isidentical commented Jul 9, 2020
Closing this in favor of #21417 |
https://bugs.python.org/issue39981