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 r.david.murray
Recipients Pam.McANulty, Sean.Grider, benjamin.peterson, r.david.murray, yselivanov
Date 2016-12-23.19:22:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1482520943.1.0.338495204643.issue14483@psf.upfronthosting.co.za>
In-reply-to
Content
Well, there's nobody being paid for keeping track of bugs and responding, so things do slip through the cracks.  Pinging an issue after there's been a lack of response for a while is appropriate, if you notice it yourself :)  (Mark, while he was trying to be helpful, does not speak for the Python community.)

As far as the question of is this intentional, the answer is yes.  Presumably you are calling it on the 'main' function.  If you call it on the module, you will get all source lines from that module.  (You can't call it "on the file", the argument must be an object.)

You'll see why it is intentional for the 'main' case if you consider that while in Python whitespace is syntactically significant, this is *not* true for Python comments indentation, because comments are treated as if they *are* whitespace.  getsourcelines stops looking at sourcelines on the last line recorded in the lnotab for that function, so any subsequent comments are not considered part of the function.

So, I'm closing this as "not a bug" since it works as expected for me in both python 2.7 and 3.6.

Thanks for waking the issue up, Pam.  You have contributed to python by getting an open issue closed, but you'll have to find something else to work on during the break I'm afraid.
History
Date User Action Args
2016-12-23 19:22:23r.david.murraysetrecipients: + r.david.murray, benjamin.peterson, Pam.McANulty, Sean.Grider, yselivanov
2016-12-23 19:22:23r.david.murraysetmessageid: <1482520943.1.0.338495204643.issue14483@psf.upfronthosting.co.za>
2016-12-23 19:22:23r.david.murraylinkissue14483 messages
2016-12-23 19:22:22r.david.murraycreate