GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — gh-126835: Move constant unaryop & binop folding to CFG by WolframAlph · Pull Request #129550 · python/cpython Conversation
|
| self.assert_ast(result_code, non_optimized_target, optimized_target) | ||
|
|
||
| def test_folding_match_case_allowed_expressions(self): | ||
| source = textwrap.dedent(""" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we also want to check for invalid expressions like duplicate mapping keys? For example:
match x: case {0j: y, 0j: z} ...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
They won't trigger error here, this is only ast parsing phase. Error is emitted in codegen.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yeah but it's not tested anywhere currently and since we're changing the logic around match, it feels safer to make sure we don't change something accidentally. Though I don't insist on adding it in this PR, it's more of a general comment
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should test that, but I am not sure if in this PR as it only touches AST related logic.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You can add tests covering various aspects of the feature you're touching.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@iritkatriel CI reports unused functions, but we need them in assertions. So either mark them as used or convert them to macros I guess? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Put them under |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…nary_expr only on debug builds
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I've addressed review & simplifed match pattern folding. One question remaining whether we should add tests with hand crafted ast with invalid expressions in match statement case. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This is looking good. I made some final minor comments. Are you still planning to add tests for invalid hand-crafted ASTs? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Done. Honestly I don't think we need them. We already test folding in match cases quite extensively, and current folding is the same as previous, just for limited expressions. We could add them for completeness, but probably in another PR as this one is getting quite big. But if you think we need them, I could add to this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sure. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It would be good to add smoke tests to make sure we don't crash on invalid ast input. Can be in another pr. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @iritkatriel for guidance & patience. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
!buildbot refleak |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @iritkatriel for commit cafbc61 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F129550%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.