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 Thomas Haller
Recipients Thomas Haller
Date 2019-09-26.09:10:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569489054.37.0.072331097916.issue38283@roundup.psfhosted.org>
In-reply-to
Content
The line number for the frame object changed behaviour in 3.8.

I am seeing this on Fedora rawhide, which ships "3.8.0~b4-1.fc32" package.

That happens when wrapping lines for calling functions.

Before, the line number sys._getframe(1).f_lineno indicate the last line. Now it is the first line.



Reproducer:

>>>
#!/usr/bin/env python

import sys


def func(a, b, c, d):

    frame = sys._getframe(1)

    print('call: %s' % (a))
    print('frame:                %s' % (frame))
    print('frame.f_code.co_name: %s' % (frame.f_code.co_name))
    print('frame.f_lineno:       %s' % (frame.f_lineno))


func('call 1, 1 line', 0, 1, 2)

func('call 2, 2 lines',
     0, 1, 2)

func('call 3, 4 lines',
     0,
     1,
     2)

<<<<


with python2 and python<=3.7, the line numbers are 16, 19, 24, respectively.

With 3.8, it changes to 16, 18, 21.
History
Date User Action Args
2019-09-26 09:10:54Thomas Hallersetrecipients: + Thomas Haller
2019-09-26 09:10:54Thomas Hallersetmessageid: <1569489054.37.0.072331097916.issue38283@roundup.psfhosted.org>
2019-09-26 09:10:54Thomas Hallerlinkissue38283 messages
2019-09-26 09:10:54Thomas Hallercreate