This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, lys.nikolaou, pablogsal, serhiy.storchaka
Date 2020-01-09.17:42:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578591732.21.0.428202486068.issue39235@roundup.psfhosted.org>
In-reply-to
Content
OK, so I looked into this (sine we can't wait for Serhiy).

The problem was probably introduced when Ivan added end lineno/column attributes to parse tree nodes. The offending copy_location() call copies the begin and end locations from the given node (maybegenbeg). But in the problematic case, maybegenbeg is just the left paren in the function call, not the node representing the surrounding () group.

But there's a separate argument to ast_for_call(), closepar, that should be used for the end lineno/offset.

Looking at the various calls to ast_for_call() in Python/ast.c, we find these:

- ast_for_decorator -- passes the open and close parentheses- ast_for_trailer -- passes the open and close parentheses
- ast_for_classdef -- passes NULL (because no genexpr allowed here)

So instead of calling copy_location() we should manually set the begin and end positions.

An alternative would be to add a second node* argument to copy_location(). That would require us to modify all 5 calls to it, but it still feels the better way to go. I'll see if I can produce a PR for that.
History
Date User Action Args
2020-01-09 17:42:12gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, lys.nikolaou, pablogsal
2020-01-09 17:42:12gvanrossumsetmessageid: <1578591732.21.0.428202486068.issue39235@roundup.psfhosted.org>
2020-01-09 17:42:12gvanrossumlinkissue39235 messages
2020-01-09 17:42:11gvanrossumcreate