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 xtreak
Recipients Windson Yang, pablogsal, serhiy.storchaka, xtreak, yselivanov
Date 2018-11-03.18:53:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1541271215.04.0.788709270274.issue35113@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks Serhiy for the details. I think there are also less tests for inspect.findsource with respect to classes though it's more robust than the regex approach. Thus there might be different effects which are correct now or selects an alternate candidate as you have mentioned. I think this is worth adding a test case once the behavior is finalized. 

On a general note I am curious is there any patch to add line number directly to the class as an attribute? I think inspect module uses object.co_firstlineno where object is a code object and works for function object. Is there any technical difficulty in this? I searched the mailing list and PEPs but couldn't come across anything. Also there are couple of issues around showing source from REPL where it's not saved to the file issue33826, issue12920.

There is one more frame pointer issue that is not working with class objects with a PR that fixes some more issues in findsource with respect to classes : issue35101.


Thanks
History
Date User Action Args
2018-11-03 18:53:35xtreaksetrecipients: + xtreak, serhiy.storchaka, yselivanov, pablogsal, Windson Yang
2018-11-03 18:53:35xtreaksetmessageid: <1541271215.04.0.788709270274.issue35113@psf.upfronthosting.co.za>
2018-11-03 18:53:35xtreaklinkissue35113 messages
2018-11-03 18:53:34xtreakcreate