Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-98390: Fix source locations of boolean sub-expressions#98396
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 ourterms of service andprivacy 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
brandtbucher left a comment• 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.
Thanks, looks good.
One comment: I don't think this function needsploc anymore.LOC(e) is correct for everything emitted here, right?
It's actually abug that theCompare_kind case sets the location without restoring it after. I introduced it in#96968 but haven't fixed it yet (since I didn't want to interfere with your refactoring work).
I'm going over all the call sites to see who consumes the modified ploc (expect a PR about assert shortly). Once nobody consumes it, I will convert it to loc. |
hi@iritkatriel, script: deffunc():assertaandb<c ,"msg"importdisforiindis.get_instructions(func):ifi.opnamein ("COMPARE_OP","CALL"):print(i.positions,i.opname,i.argval) output (Python 3.11.1): Positions(lineno=2,end_lineno=2,col_offset=17,end_col_offset=20)COMPARE_OP<Positions(lineno=2,end_lineno=2,col_offset=17,end_col_offset=20)CALL0 The CALL is the creation of the assertion which has the same source range as output (Python 3.11.0): Positions(lineno=2,end_lineno=2,col_offset=17,end_col_offset=20)COMPARE_OP<Positions(lineno=2,end_lineno=2,col_offset=4,end_col_offset=28)CALL0 The source range of CALL in 3.11.0 is the whole assertion, which looks reasonable for me. Some context: |
@15r10nk the behavior on @iritkatriel what do you think, is this a candidate for backport? |
brandtbucher commentedDec 20, 2022 • 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.
It probably makes the most sense just to fix 3.11 separately (with a backport to 3.10), since location-related stuff has changed a lot on main. I assigned myself to the issue a while back, but other things came up. I'll just make a PR now (thanks for the reminder@15r10nk)! |
@carljm yes. I found this problem in 3.11.1. |
Uh oh!
There was an error while loading.Please reload this page.
Fixes#98390.