fix stack issues with AST_Node.evaluate()#1603
Conversation
As patched in mishoo#1597, `make_node_from_constant()` makes inconsistent and sometimes incorrect calls to `optimize()` and `transform()`. Fix those issues properly by changing the semantics of `evaluate()` and `make_node_from_constant()`, with the side effect that `evaluate()` no longer eagerly converts constant to `AST_Node`.
|
@kzc as per 8223b2e#commitcomment-21332046, PTAL at c2f6bc4 and see if you want to reword it. |
|
The comment is helpful. Thanks. But I think the comment should be above both |
|
@kzc that is the million dollar question 😏 ... what I mean is, in #1593 when I make everything work in the simplest way possible, it harms overall performance significantly. So I decided to attack this from a different angle - preserve existing steps as much as possible whilst incrementally fix up stack-related issues one by one. So I struggle to describe what this does other than "it did so before and it worked", at least for now. 😓 |
|
If the code in question is changed to call |
|
Even a comment to the effect that two calls to Edit: while keeping your existing explanation. |
|
The comments are good. They'll serve as a warning to anyone looking to modify this code. |
As patched in #1597,
make_node_from_constant()makes inconsistent and sometimes incorrect calls tooptimize()andtransform().Fix those issues properly by changing the semantics of
evaluate()andmake_node_from_constant(), with the side effect thatevaluate()no longer eagerly converts constant toAST_Node.