Message353279
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. |
|
Date |
User |
Action |
Args |
2019-09-26 09:10:54 | Thomas Haller | set | recipients:
+ Thomas Haller |
2019-09-26 09:10:54 | Thomas Haller | set | messageid: <1569489054.37.0.072331097916.issue38283@roundup.psfhosted.org> |
2019-09-26 09:10:54 | Thomas Haller | link | issue38283 messages |
2019-09-26 09:10:54 | Thomas Haller | create | |
|