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 — bpo-40334: Produce better error messages on invalid targets by lysnikolaou · Pull Request #20106 · python/cpython Conversation
|
|
Since the error messages will not change I removed the |
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 a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Almost there!
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.
|
|
||
| expr_ty | ||
| _PyPegen_get_invalid_target(expr_ty e) | ||
| _PyPegen_get_invalid_target(expr_ty e, int del_targets) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can you please adopt a naming convention that makes it clear that this is effectively a bool? I was a bit baffled by this for a while. A venerable convention is to use names like is_foo or has_bar.
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.
Not sure, if is_del is okay, because the questions "What's del, the target, which target?" comes to mind. What do you think?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Pablo Galindo <[email protected]>
Co-authored-by: Pablo Galindo <[email protected]>
Correctly identify invalid targets, when there are multiple context managers in a with statement, avoid SEGFAULT in invalid for targets and improve paremeter naming in _PyPegen_get_invalid_target.
There was an error while loading. Please reload this page.
|
I have updated the PR with the latest changes from #20003 |
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.
Hm... I poked another hole here. :-(
>>> for i, (f, g()) in 10: pass
Assertion failed: (e != NULL && e->kind == Compare_kind), function _PyPegen_get_invalid_for_target, file Parser/pegen/pegen.c, line 2110.
Abort trap: 6
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Simpler example that gets the same error: And this too: I recommend extreme caution here. If I can poke holes this quickly, I worry that we may be causing a regression if we rush this in before beta1. We obviously don't have the right testing strategy here. There's nothing that says we have to get this level of detail right in beta1. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…PyPegen_get_invalid_target
I pushed a version that I think is pretty close, but I'm not 100% certain. I agree, that there's no rush to land this and that we should test a bit more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
What I meant is that; since this PR already generates 'can't use starred expression here' error messages for some cases, it isn't fully compatible with the old parser.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think I understand now. Indeed the old parser used to produce Also, I can remember @pablogsal mentioning somewhere that changing just the message is okay in terms of backwards-compatibility. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I see, didn't notice that. Sorry for distraction.
So, is this error will be kept ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I like the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Same here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| FOR_TARGETS | ||
| } TARGETS_TYPE; | ||
| expr_ty _PyPegen_get_invalid_target(expr_ty e, TARGETS_TYPE targets_type); | ||
| #define GET_INVALID_TARGET(e) _PyPegen_get_invalid_target(e, STAR_TARGETS) |
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.
Maybe we should surround _PyPegen_get_invalid_target in a CHECK to make sure this does not return NULL (and not crash in that 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.
After reviewing it again I have played with it a bit more (before the CHECK commit) and I was not able to break it in any way so I think we can land it now so more people interact with it and it this way we could detect any non-trivial problems if they exist.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a00b611 to
55b5327
Compare
|
FYI there is an unrelated CI failure on macOS in test_asyncio. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @lysnikolaou for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @lysnikolaou and @pablogsal, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@lysnikolaou Could you do the manual backport? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Of course, on it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-20106) The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <[email protected]> (cherry picked from commit 01ece63)
|
GH-20973 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-20106) (GH-20973) * bpo-40334: Produce better error messages on invalid targets (GH-20106) The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <[email protected]> (cherry picked from commit 01ece63)
|
FYI, appears to have caused a regression: https://bugs.python.org/issue41060. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-20106) The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <[email protected]>
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.