Message315074
In my PR, I added `def_lineno` and `class_lineno` as fields in the ASDL, instead of attributes (since constructors cannot have attributes, only types can). This means they show up in `ast.dump` which is probably not the desired behavior, as it makes the dumped ast whitespace/line offset sensitive.
Therefore I propose we change the line number of the nodes to be the one of the def/class statement. It seems based on [this commit](https://github.com/python/cpython/commit/09aaa88328a5083469b2682230c7f3c62942afab) that the change was done to fix inspect.getsource (so that it started on the first decorator), but I think it is much more logical for inspect to handle decorated items instead of having the ast lie.
One other option could be for a modified ast to have a decorated node, which holds the decorator list, and the class/function. This has the possible downside of being a not-insignificant change to the ast. |
|
Date |
User |
Action |
Args |
2018-04-07 21:29:28 | ethan smith | set | recipients:
+ ethan smith, serhiy.storchaka, levkivskyi, nitishch, gforcada |
2018-04-07 21:29:28 | ethan smith | set | messageid: <1523136568.39.0.682650639539.issue33211@psf.upfronthosting.co.za> |
2018-04-07 21:29:28 | ethan smith | link | issue33211 messages |
2018-04-07 21:29:28 | ethan smith | create | |
|