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-40726: handle uninitalized end_lineno on ast.increment_lineno#20312
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 May 22, 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.
laloch commented May 22, 2020
I think this also needs some treatment: Lines 180 to 184 in c102a14
|
remilapeyre commented May 22, 2020
Hi @isidentical, thanks for fixing this. It seems to me that if all nodes have all their attributes defined, the calls to if ( "end_lineno"inchild._attributesand (end_lineno:=getattr(child, "end_lineno", 0)) isnotNone ): child.end_lineno=end_lineno+ncould be ifchild.end_linenoisnotNone: child.end_lineno+=n? |
isidentical commented May 22, 2020
Sorry, but I couldn't catch the reason. There is already a verification for Lines 183 to 184 in c102a14
That is just the current implementation, and in theory it might not exist at all as-well, which would prevent us from backporting this patch to 3.8 as it is. |
laloch commented May 22, 2020
Sorry, I should have been more verbose. I know this is not a real-world use case, but here's an example: In the end, the value of |
isidentical commented May 22, 2020
Oh, this is an interesting case. Nice catch! |
7ab5685 to 2444b63Comparelaloch commented May 22, 2020
I can confirm that this does fix xonsh/xonsh#3581. |
laloch commented Aug 5, 2020
Is this planed to get merged for v3.9.0? This currently blocks Python 3.9 adoption in Xonsh. |
miss-islington commented Aug 5, 2020
Thanks @isidentical for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
bedevere-bot commented Aug 5, 2020
GH-21741 is a backport of this pull request to the 3.9 branch. |
…thonGH-20312) (cherry picked from commit 8f4380d) Co-authored-by: Batuhan Taskaya <[email protected]>
miss-islington commented Aug 5, 2020
Sorry, @isidentical and @pablogsal, I could not cleanly backport this to |
bedevere-bot commented Aug 5, 2020
GH-21742 is a backport of this pull request to the 3.8 branch. |
pablogsal commented Aug 5, 2020
laloch commented Aug 5, 2020
Thanks @pablogsal! |
…-20312) (cherry picked from commit 8f4380d) Co-authored-by: Batuhan Taskaya <[email protected]>
…no (pythonGH-20312). (cherry picked from commit 8f4380d) Co-authored-by: Batuhan Taskaya <[email protected]>
…no (pythonGH-20312). (cherry picked from commit 8f4380d) Co-authored-by: Batuhan Taskaya <[email protected]>
…no (GH-21745) …no (GH-20312). (cherry picked from commit 8f4380d) Co-authored-by: Batuhan Taskaya <[email protected]> Automerge-Triggered-By: @pablogsal
miss-islington commented Aug 11, 2020
Thanks @isidentical for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
miss-islington commented Aug 11, 2020
Sorry, @isidentical and @pablogsal, I could not cleanly backport this to |
ambv commented Aug 11, 2020
Ah, never mind, #21741 is the backport that's already merged. |
end_linenois declared as an optional attribute on the ASDL spec. This patch makesincrement_linenoaware that node'send_linenomight beNone.https://bugs.python.org/issue40726