tests/misc/sys_settrace_features.py: Fix to run on newer CPython.
This test was failing on CPython 3.11 as it now emits `0` as the line number for the "call" event corresponding to import, where as in 3.6 it had `1` as the line number. We maintain the old behavior, but in order to make this test pass on both CPython versions, the trace handler now converts the `0` to a `1`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
1dedb65e64
commit
4a3fdc0e76
|
@ -22,7 +22,9 @@ def print_stacktrace(frame, level=0):
|
|||
frame.f_code.co_name,
|
||||
# Keep just the filename.
|
||||
"sys_settrace_" + frame.f_code.co_filename.split("sys_settrace_")[-1],
|
||||
frame.f_lineno,
|
||||
max(
|
||||
1, frame.f_lineno
|
||||
), # CPython 3.11 emits `0` where CPython 3.6 emits `1` for the "call" event corresponding to import.
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue