Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35113>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to