Author terry.reedy
Recipients bkcsfi sfi, malthe, terry.reedy, yselivanov
Date 2015-06-26.20:46:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1435351598.91.0.0702642823042.issue24485@psf.upfronthosting.co.za>
In-reply-to
Content
The test suite must lack, and therefore needs, a simple testcase as in test.py.

In 3.4 and 3.5, getsource() joins the list of lines returned by getsourcelines().  In both versions, getsourcelines uses findsource(), which seems to be unchanged.  In 3.5, the output of findsource for code, function, and method objects is postprocessed by _line_number_helper(code_object).  The bug applies to methods also.

class C:
    def outer():
        def inner():
            inner1
from inspect import getsource
print(getsource(C.outer))

omits 'inner1', but getsource(C) does not.  I believe the regression is due to ac86e5b2d45b in #21217.  (At first glance, it would seem that the fixup in _line_number_helper should be in the code object part of findsource itself.)  I requested on that issue that the authors take a look at this.
History
Date User Action Args
2015-06-26 20:46:38terry.reedysetrecipients: + terry.reedy, yselivanov, malthe, bkcsfi sfi
2015-06-26 20:46:38terry.reedysetmessageid: <1435351598.91.0.0702642823042.issue24485@psf.upfronthosting.co.za>
2015-06-26 20:46:38terry.reedylinkissue24485 messages
2015-06-26 20:46:38terry.reedycreate